How To Select First Two Words of a Cell With Split method

Hi everyone,

I need to define a variable in a for each row activity.

This variable must take the first two words of the text that written in datatable.

I know i should use split method but i could not build a structure.

Is there anyone know how can i do that?

@mazlumkacar,

Try like this,

  row("Column1").ToString.Split(" "c)(0).ToString + row("Column1").ToString.Split(" "c)(1).ToString
1 Like

Hi
Hope these steps would help you resolve this
—once after getting the datatable use For each row loop and pass the above datatable as input
—inside the loop use a assign activity with expression like this
Str_output = Split(row(“yourcolumnname”).ToString,” “)(0).ToString+“ “+ Split(row(“yourcolumnname”).ToString,” “)(1).ToString

Where str_output is a variable of type string
Or
If we want to assign back to the same row then
row(“yourcolumnname”)= Split(row(“yourcolumnname”).ToString,” “)(0).ToString+“ “+ Split(row(“yourcolumnname”).ToString,” “)(1).ToString

Cheers @mazlumkacar

1 Like

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