Spliting the values

i have a scenario where i will be getting the codes from pdf… and iam extracting it
and placing in one variable for example
Codes = “T42.52,M65.89,S98.33,M24.572,Z47.89,R26.2,S83.51,Z33.90”

so, 1) if these codes have start with “Z” then we have to take it as main priority.
2) If these codes doesnt start with “Z” then we can take available codes

we don’t know how many codes we get… but we have to take only four codes … and apply the above conditions… and also we may get less than 4 codes also…

please please tell me the approach

Hi @Nikhil_Katta

  1. Get the extracted codes into a string variable: Assuming you have extracted the codes and stored them in a variable named Codes , as you mentioned.
  2. Split the codes into a list:
Assign → CodeList = Codes.Split(","c)
  1. Initialize variables
Assign → PriorityCodes = New List(Of String)()
Assign → OtherCodes = New List(Of String)()
Assign → SelectedCodes = New List(Of String)()
  1. Iterate through the CodeList
For Each code As String In CodeList
    If code.StartsWith("Z") Then
  1. Join the selected codes back into a string:
Assign → FinalSelectedCodes = String.Join(",", PriorityCodes)

Check the below workflow for better understanding:
Sequence26.xaml (11.9 KB)

Hope it helps!!


codesList = Codes.Split(","c)
Prioritylist=New List(Of String)
If code.StartsWith(“Z”) Then
Add to priority collection list
Add to available codes list

Hi @Nikhil_Katta

Please find below xaml for your reference

BlankProcess7.zip (185.5 KB)

I hope it helps!!


Firstly you can split the text by using the split or regex pattern so after that it will give the collection, so then based on index you can cal add to an array then you can pass in the for each loop

  1. Take if activity and pass the condition like this

It will match the Z starting then add to one variable- in then section

Or else if it not match then it not contain Z in else you can add to another variable.

For the reference please check the below screenshot for regex pattern !

Cheers @Nikhil_Katta

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.