Hello,
I have a set of variables and values in a form of string. All I want is to fetch each n every Key/Value pair from the string as a separate variable value
for eg: Lets say my string is as below stored in "local!mixedString" variable
"Name:Vivek|Work:Development|Tool:Appian|Experience:2 years|.... So on"
Now as we can see each Key/Value pair is separated by "|" symbol. Can someone please help me to separate each value in different variables?
So my desired output will be
Name:Vivek
Work:Development
Tool:Appian
Experience:2 years,
Where Name,Work,Tool and experience is now become a variable having the same value as it is in the first string variable
FYI: The string is dynamic and the list of Key/Value pair changes everytime based on some specific condition.
Discussion posts and replies are publicly visible
I'm pretty sure the below will do what you require, or at least will give you a starting point. It's probably worth noting that your data really shouldnt be in the format you have, but I'm guessing you don't have control over that.
with( local!mixedString: "Name:Vivek|Work:Development|Tool:Appian", a!forEach( items: split( local!mixedString, "|" ), expression: with( local!item: split( fv!item, ":" ), type!NameValue( name: local!item[1], value: local!item[2] ) ) ) )