Split line logic in datatable

Hi all,

Assume we have datatable in which some rows vaules are split in to next row need to check that rows and merge in to above row.

conditions: we don’t know how many rows are there and how many columns are there.

sample table:

Required Output 

column a	column b	column c	column d	column e	column f	column g	column h	column i
1	parts1	55	678	60 units	banglore		78	99
2	parts2	66	787	90 units	HYD		78	765
3	parts4	765	675	2 units	kolkatta		8765	9098
4	parts6	675	7654	9 units	noida		675	8909


![image|690x120](upload://71tE4HJJ4ct5EkW3pz1xG6AU7uE.png)


Thanks and Regards.
Praveen

hi

need some information what prior step or what is the source of data , reason why it is split

reason being to check if their is any chance of avoiding to split into this condition

Regards

@PRAVEEN_VARMA

Welcome to the community

Follow the steps

  1. Use a for each row in datatable and loop through the data and in the properties there is a index property assign a variable idx to it
  2. Inside use a if condition with IsNothing(currentrow("Col A")) OrElse String.IsNullOrEmpty(CurrentRow("Col A").ToString)
  3. On the then side use afor loop with dt.Columns.ToArray and change type argument in for loop properties to datacolumn
  4. Now inside the second loop use assign
    Currentrow(currentitem.ColumnName) = dt.Rows(idx)(currentitem.ColumnName).ToString + currentrow(currentitem.ColumnName).ToString

After both the loops use filter datatable and filter the first column with non empty

Hope this helps

Cheers

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