I want to add all the values in the below String in different Variables For a
single Input String
- Capitec,15176, sav
I want the Variable value as
Var1 = “9182”
Var2 = “Nonhlanhla”
Var3 = “firstname.lastname@example.org”
Var4 =" 11409
Var5 = Capitec,15176, sav
Can some one help me out
is the string is separated by new line if so use this
you can call each value by index and assign to a variable
Hi @Kethavath_Shankar_Naik ,
Maybe we could try with a regex operation where we can store each key(Starting Numbering) with value as Dictionary.
Using the below Regex :
Steps to Perform :
Add a “0.” at the End of the Input String so that we will be able to anchor and get the last item as well with the regex developed.
Find Matching Patterns activity with the regex provided above and get the matched collection.
Converting the matched data to a Dictionary variable so that we can access the each value using the Line Number as the key. Below is the Expression used :
dictVariables = mc.Cast(Of Match).ToDictionary(Function(x)(mc.ToList.IndexOf(x)+1).ToString,Function(y)y.Value.Trim)
dictVariables is of Type Dictionary(Of String,String) and
mc is the Output of
Find Matching Patterns activity.
Let us know if this works for your case and if not, let us know why.
Do we need any Packages to download Can you please let me know
No, We would not need any external packages. The
Find Matching Patterns activity could also be
Matches activity for your version of Studio.
The Dictionary Variable the values will Vary Every Time
so i need the values in a dynamic Way
I believe the solution suggested is dynamic, Did it not work for some input data ? If so, could you provide us that data ?
If you are getting string in below format
- Capitec,15176, sav
You can split string with new line
and assign activity assign string to your variable using index ),1 etc
can you suggest a solution here i am unable to fetch Value
As provided in the Debugging Panel, I have used a String, and not a Integer value for the Dictionary key, so give a try with :
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.