How to convert dt to list of string and then get specific value

Hi All,

i have converted the datatable to list of string, then want to extact user id from string. img for reference.

exp- Ugur Cayirli (UCAYIRLI) i want only values inside parenthesis. UCAYIRLI


already converted to list of string, now how to get above value from list of string.

Thanks

Hi @RAKESH_KUMAR_Tiwari ,

Could you let us know How is the Data present in the Datatable ? Is User ID and Responsible User two different columns or the same column ?

Maybe for your case, you need to use Look Up Datatable activity instead of using the Expression.

column name is “Responsible user”

and it has some values, and one of the value is “Ugur Cayirli (UCAYIRLI)”, want to extarct only the value under parenthesis.

why lookup datatable, i didn’t understand.

column name is “Responsible user”

and it has some values, and one of the value is “Ugur Cayirli (UCAYIRLI)”, want to extarct only the value under parenthesis.

why lookup datatable, i didn’t understand.

or understand like this i have value in currentrow of for each, i wnat to get (UCAYIRLI).

@RAKESH_KUMAR_Tiwari ,

Maybe we can use regex to extract the value required :

Regex.Match("Ugur Cayirli (UCAYIRLI)","(?<=\().*?(?=\))").Value

image

ok,but the row value will be changed in every time in loop,

se img

image
now how to achieve.

i want to get distinct value and then wnat to get only that value means under parenthesis.

@RAKESH_KUMAR_Tiwari ,

In place of the hard coded value we would have to use the iterative row value :

Regex.Match(row("Responsible User").ToString,"(?<=\().*?(?=\))").Value

Hi @RAKESH_KUMAR_Tiwari

Can you try this-

Use a For Each activity to iterate through each string in the list. Within the For Each loop, use the Assign activity to extract the user ID using regex and store it in a separate variable.

userId = System.Text.RegularExpressions.Regex.Match(item, “((.*?))”).Groups(1).Value

Thanks!

@RAKESH_KUMAR_Tiwari ,

You would require to import System.Text.RegularExpressions from the Imports Panel :
image

@RAKESH_KUMAR_Tiwari ,

I believe you are not using the Expression I have provided above. Do double check on the post above, replace row with your CurrentRow instance variable.

What is the datatype of currentRow?

Hi @Nitya1 ,

DataROw, i am getting null output.

Hi @Nitya1 ,

DataROw, i am getting null output. And also it is going in infinite loop i think. pls check the expression below.

image