How to insert values in a string into a DT?


I have two string variables with informacion delimited by the symbol /
Variable1: Hello/my/name/is/Peter
Variable 2: Bye/your/surname/is/Jackson

There can be any undetermined number of / for each variable (it may be 4 as in the example but also 5, 7, 92, 101…)

I need to insert those information in a Data Table so that Variable1 is in the first column and Variable2 in the second column:


Column A Column B
Row0 Hello Bye
Row1 my your
Row2 name surname
Row3 is is
Row4 Peter Jackson

Please, could you help me?

Hi @Welcoming,

You can use assign activity and assign the value as

datatable.Rows(row_index)(“ColumnName”)= Variable 1
datatable.Rows(row_index)(“ColumnName or Column Index”)= Variable 2

Thank you. The issue is that every row contained in each column is separated by ‘/’ in the variables… So I would need first to get the information in the variables… wouldn’t I?

Split the strings a below and return a list

bring all lists (for your different strings) to an equal length

  • retrive the length of the longest list

  • fill up all other lists with blanks

  • prepeare your empty datatable (build datatable) manually / dynamic addition of the data columns

  • add the datarows by accessing the list with looped index like myList1(0) for retriving the value for the first row

In this case use,

  1. Assign activity

Var[array string datatype] = String.split("/"c)

  1. Use AddDataRow activity to add data to datatable.
    In Property panel of adddatrow, in ArrayRow pass tat variable & in DataTable pass DataTable_Variable
1 Like

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