- Read the data into Datatable
- Use for loop with dt.Columns
- Inside use if condition
currentitem.ColumnName.StartsWith("A-")
- on then side use assign with
dt.rows(0)(currentitem.ColumnName) = dt.AsEnumerable.Last(function(x) Not String.IsNullOrEmpty(x(currentitem.ColumnName).ToString))(currentitem.ColumnName).ToString
Hope this helps
cheers
try below steps
-
read to datatable dt using read csv
-
use for each loop to iterate through columns
dt.Columns
as in and type argument assystem.data.datacolumn
-
use if condition as below
column.ColumnName.StartsWith("A-")
-
Use assign activity in then block as below
left side
dt.Rows(dt.rows.IndexOf(dt.AsEnumerable.SkipWhile(Function(x) not String.IsNullOrWhiteSpace(x(column.ColumnName).ToString)).first)-1)(column.ColumnName)
right side
dt.rows(0)(column.ColumnName)
Later write back the same data table to csv
Hope this helps
Can you run in debug and when error comes can you please open the dtwendy and check if it has data in it
May be a screenshot would help…as per error it says all rows are empty
Cheers
if whole colomn are empty then i got error
please send solution
In the if condition add this as well
currentitem.ColumnName.StartsWith("A-") AndAlso dt.AsEnumerable.Where(function(x) Not String.IsNullOrEmpty(x(currentitem.ColumnName).ToString)).Count>0
Cheers
It’s work but output getting wrong i need last row value but it’s come previous colomn value
did you try the solution i provided?
if there any total blank values in any column then add condition
column.ColumnName.StartsWith("A-") AndAlso dt.AsEnumerable.Where(function(x) Not String.IsNullOrEmpty(x(column.ColumnName).ToString)).Count>0
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.