I want to separate this Datable till Total A column then Total B column.
In Summary
rows till TOTAL A column should be a different datable and rows till total b should be a different data table
Hi @Eshu_Dhiman ,
Please use below method to split the columns into different datatable
DTA=DT.DefaultView.ToTable(True,"A1","A2","A3","A4","A5","TOTAL A")
DTB=DT.DefaultView.ToTable(True,"B1","B2","B3","TOTAL B")
Regards,
Arivu
check the reference
i dont want to specify the column names any idea around that?
Thanks for the reply
I dont think you get the question right?
Hi @Eshu_Dhiman
Can you try the below
Sequence17.xaml (12.6 KB)
Result:
Input.xlsx (9.6 KB)
Regards,
THANKS THIS WORKS GREATLY APPRICIATE YOU I HAD A SIMILAR IDEA BUT DIDNT KNOW HOW TO IMPLEMENT
calculating it dynamically, but we will also depend on col name patterns
sample DataTable Structure:
Assign Activity:
ColSets | List(Of String()) - a list of String Arrays =
(From c In dtData.Columns.Cast(Of DataColumn)
Let tkn = System.Text.RegularExpressions.Regex.Match(c.ColumnName.Trim,"^[A-Z]+(?=\d)|(?<=Total )[A-Z]+$" )
Where tkn.Success
Group c By k=tkn.Value Into grp=Group
Let cset = grp.OrderBy(Function (x) x.Ordinal).Select(Function (x) x.ColumnName).toArray
Select r=cset).toList
And can later loop over the ColSets and using the String Array for the DefaultView.ToTable
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.