Difference between revisions of "GetSingleConstant"
Line 7: | Line 7: | ||
'''Syntax''' | '''Syntax''' | ||
− | getSingleConstant(''name [, resource_Guid]'') | + | getSingleConstant(''name [, resource_Guid | resourceId]'') |
'''Arguments''' | '''Arguments''' | ||
Line 15: | Line 15: | ||
''resource_Guid:'' Is a string expression. It is the Guid of the resource. | ''resource_Guid:'' Is a string expression. It is the Guid of the resource. | ||
− | If there is no resource_Guid specified, the function will get the Single constant from the current resource project questionnaire’s project questionnaire (i.e. a resource project questionnaire context is needed). | + | ''resourceId:'' number. Resource Id of resource. |
+ | |||
+ | If there is no resource_Guid or resourceId specified, the function will get the Single constant from the current resource project questionnaire’s project questionnaire (i.e. a resource project questionnaire context is needed). | ||
'''Return type''' | '''Return type''' | ||
Line 23: | Line 25: | ||
'''Examples''' | '''Examples''' | ||
+ | <span style="color:#DF8621"> Use resourceGUID </span> | ||
+ | <source lang="csharp"> | ||
number value = getSingleConstant("MySingleConstant", "9FB4543F-84F7-4B5E-91F2-5DEFE72B1FB3"); | number value = getSingleConstant("MySingleConstant", "9FB4543F-84F7-4B5E-91F2-5DEFE72B1FB3"); | ||
+ | // return 2 if value option 2 is selected | ||
+ | </source> | ||
+ | |||
+ | <span style="color:#DF8621"> Use resourceId </span> | ||
+ | <source lang="csharp"> | ||
+ | number value = getSingleConstant("MySingleConstant", 12345678); | ||
+ | // return 2 if value option 2 is selected | ||
+ | </source> | ||
'''Availability''' | '''Availability''' | ||
Version 5.4 __NOTOC__ <!-- imported from file: 4047.htm--> | Version 5.4 __NOTOC__ <!-- imported from file: 4047.htm--> |
Latest revision as of 06:16, 31 December 2018
getSingleConstant
Gets the selected option's index (start from 1) of a Single constant belonging to a specific resource.
Syntax
getSingleConstant(name [, resource_Guid | resourceId])
Arguments
name: Is a string expression. It is the name of the constant.
resource_Guid: Is a string expression. It is the Guid of the resource.
resourceId: number. Resource Id of resource.
If there is no resource_Guid or resourceId specified, the function will get the Single constant from the current resource project questionnaire’s project questionnaire (i.e. a resource project questionnaire context is needed).
Return type
number
Examples
Use resourceGUID
number value = getSingleConstant("MySingleConstant", "9FB4543F-84F7-4B5E-91F2-5DEFE72B1FB3");
// return 2 if value option 2 is selected
Use resourceId
number value = getSingleConstant("MySingleConstant", 12345678);
// return 2 if value option 2 is selected
Availability
Version 5.4