How to join the values of two columns into single column

Hi Guys!!

I used generate data table activity to create datatable from a text file content. The output was created into two columns but I need it in a single column like below. How can I achieve this
A

Thanks in Advance!!

Hi @mohamedalthaf

You can use this query in the Invoke Code activity:

io_dt.AsEnumerable.ToList.ForEach(Sub(row)
row(2) = row(0).ToString+row(1).ToString
End Sub)

Invoke Code Edit Arguments panel will be:

Hope this helps,
Best Regards.

1 Like

@arjunshenoy Thanks brother.

I have an other doubt. Is it possible to have the columns in a dynamic way like sometimes instead of A,B columns alone, C & D columns may also appear. So by the time I need to merge A,B,C,D columns into single column. So is it possible to have the merging method in dynamic way?

@mohamedalthaf

In that case, yourDt.Columns.Count will give you the total number of columns present in your data table. Then you can use a For Each Row in Datatable activity to iterate through each row of the data table & start combining all column data into the last column.

On each row, you can again iterate through the columns & start combining them in a variable called combinedColumnData. You can design the workflow something like this:

Regardless of the number of columns changing, the output combine all column data:

image

Hope this helps,
Best Regards.

1 Like

It sounds like maybe we should address why the generate data table activity isn’t resulting in what you want. Show us the source data and how you have the generate data table activity configured.

i guess this should be in simple way

while generate datatable their should be some delimiter to separate data between columns like , or space or any special character

So simply you can replace the delimiter with β€œβ€

The final result will be in single column without any further modifications

Regards

Thanks @LAKSHMI_NARAYANA_PEMMASAN
Working as expected.

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