Default Value Binding¶
Default Value binding allows application to display the default value when the first expression is evaluated to undefined, null or empty string.
Indicator¶
-
The
$indicator could be applied to all properties value includingstringliteral, binding, globals,ActionBar,ToolBar,FormCellcontrols,Sectionscontrols,Extensioncontrols. -
The key is
DV. -
It consists of two parameters, the first parameter is for target expression, and the second parameter for default value.
-
It is advised to add single quote (\') for string literal within the indicator to mark the start and end of the string value, e.g.
$(DV,'{Binding}','Unknown') -
The supported value types for parameter are
string,integer,boolean,Resolvablevalue types. -
Complex types (
arrayandobject) are not supported as parameter value. -
Specify
null, If no value is to be set on one of the platform parameters.
Description¶
Return the specified string according to platform.
Usage¶
$(DV, <Target expression>, <Value for default>)
Parameters:
| Parameter Name | Type | Required? | Description |
|---|---|---|---|
| Target expression | String Literal, ResolvableValue |
Mandatory | Expression will be evaluated |
| Value for default | String Literal, ResolvableValue |
Optional | Default value if the Target expression being evaluated to undefined, null or empty string |
Examples¶
$(DV, ,'The default text')$(DV, null, 'Unknown value')$(DV, '', 'empty string')Prefix $(DV, {SomeProperty},'Can\'t find the property') {SomeObject/ObjectPropertyA}$(DV, #ClientData/TargetPath/SomeObject/ObjectPropertyA, '/MDKDevApp/Rules/TextForIOS.js')$(DV, '/MDKDevApp/Globals/Empty.global', '$(L,see_more)')$(DV, {SomeObject/NullProperty}, '{#Application/#ClientData/MobileServiceAppId}')$(PLT, $(DV, '/MDKDevApp/Globals/Empty.global', '/MDKDevApp/Rules/TextForIOS.js'), $(DV, '/MDKDevApp/Globals/Empty.global', '/MDKDevApp/Rules/TextForAndroid.js'))