Assign 2 variable with array of string as the type into 2 columns in datatable

Hi, I have 2 variable with the type is array of string. I build data table to store the value of the variables. Anyone can help me what can I do to assign 2 variables into the 2 columns of the data table?

@newuser1
Welcome to the forum

  • use an add row activity (Google)

    • configure it for RowArray: {SE(0),UrlList(0)}
    • Datatable: YourDataTAbleVar
  • use an add row activity (Bing)

    • configure it for RowArray: {SE(1),UrlList(1)}
    • Datatable: YourDataTAbleVar

what type of each columns? string/array of string?

Loop thru your SE String array. Using “index”, you can get the value from UrlList String array (assuming their position corresponds to their values). Add new row to your data table then assign each. Afterwards, add the row to your datatable. See attached XAML file.ArrayListToDataTable.xaml (10.6 KB)

1 Like

string

Hi,

Hope the following helps you.

dt = SE.Zip(UrlList, Function(x,y) dt.Clone.LoadDataRow({x,y},False)).CopyToDataTable()

Sequence.xaml (7.8 KB)

Regards,

thank you so much, you help me alot. Where can I learn about that command?

1 Like

It work, thank you

its a combination of LINQ and .Net.
For LINQ have a look here:

3 Likes

if you please, can you explain to me the command?

Hi,

Zip method provides function to iterate 2 collections.

SE.Zip(UrlList, Function(x,y)

means iterate SE and UrlList and assign x to each item of SE and y to each item of UrlList at same index number.

Then, LoadDataRow returns datarow which items are {x,y}.

As a result, we can get datatable from them.

Hope this helps you.

Regards,

2 Likes

thank you so much

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