Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

how to customize variable name

Avatar

Level 7

Hi,

I want to access desired variables by passing variable name type string to it and it will give me value of the variable.

eg.

variableName (type string)="variable1"; <input parameter>

variableOutResult (type int) <output parameter>

variable1 <int type>=1; (default value)

variable2 <int type>=2; (default value)

using setValue activity. I want to create an expression which will return default value of variable1 or variable2

XPath mapping

(Location)                                                                                (Expression)

/process_data/@variableOutResult                                           "/process_data/@"+"/process_data/variableName"         <red colored string is access to a variable which has value as variable1 or variable2>

underlying vauriable will form "/process_data/@variable1" which should store value to variableOutResult and give result as 1.

Please let me know if you need more clarification.

Regards

Sunil

2 Replies

Avatar

Level 7

Ok, let me explain you in this way.

Precondition: Default value of variable1 is 1, variable2 is 2 and variableOutResult is 0.

Below I want to form an expression that if I pass  “variable1” in variableName the variableOutResult should result me 1. If “Variable2” as input parameter pass through variable variableName, the variableOutResult should result me 2.

Please find the attached .lca. I want to pass name of the variable as string to retrieve value in SetValue, NOT in executeScript activity.

screenshot1.jpg

I want to get form access to variable variable1 or “/process_data/@variable1”.

screenshot2.jpg

here is the .lca file.

Let me know if still I could not explain.

Regards

Sunil

Not able to attach lca but providing you image of the process.

Avatar

Level 7

Not able to attach lca but providing you image of the process.