I have this CSV Data, I want to get Duplicate value from ID column and each duplicate value set want to update last row value to be inserted in the first row of duplicate set do it in every set one by one
Hi @Garyy
Can you provide the csv file if possible.
Hi @Garyy
Check out this
I hope it helps!!
Thank you for your response but this solution is different this is not what Iâm looking
Try this
Create avariable str_id and initialize with string.Empty
- Use for each row in datatable on the data read from excel say dt
- Inside the loop use if condition with
str_id.Equals(currentRow("ID").ToString)
- On the then side do nothing
- On else side use assign with
str_id = currentRow("ID").ToString
- On the else side after assign use filter datatable actovity and filter dt and output can be filtereddtâŚand filter
"ID"
equalscurrentRow("ID").ToString
- Use another assign after filter with
currentRow("1-DD").ToString = filtereddt.Rows(filtereddt.Rowcount-1)("1-DD").ToString
This will ensure every first new row is replaced with last row
Cheers
Can you send me the xaml code
Thank You @Anil_G
But shy getting this error
Thanks @Anil_G
I have one more doubt i take only one column â1-DDâ but if i want column name start with âDD-â
how can do it
And another one if last row is empty or null then get above row value and put it in first row
Please help me
Inside the first loop âŚuse a loop for the columns and check the column names that starts or ends with DD as you need or contains DDâŚthe second loop will be on dt.Columns and type argument in loop will be DataColumn
And the if condition goes inside the second loop and instead of 1-DD use currentItem.ColumnName
And also for last but secondâŚyou need to include one more if condition before the multiple assign so that you can check the value is empty and choose last second row instead of last
Cheers
Ok I will try it
Sending a xaml is not a problemâŚbut if you try there is possibility you will learn as wellâŚgive me some time.:not in front of system will send itâŚ
But will suggest try to amend the changesâŚfor better learning
Cheers
I tried but i didnât get output what i am looking
Why getting this error
Multiple Assign: Can not assign âfiltereddt.Rows(filtereddt.RowCount-2)(currentItem.ColumnName)â to âCurrentRow(currentItem.ColumnName)â.
@Garyy
Verify that the data types of filtereddt.Rows(filtereddt.RowCount-2)(currentItem.ColumnName)
and CurrentRow(currentItem.ColumnName)
match. If they donât, you may need to convert the data types or adjust.
Hope it helps!!
Please use separate assigns or open the exception details from locals panel to check the exact error
mostly you would need to check the values in datatable if it has two rows or notâŚmay be there is no second last row and last row is empty
cheers
Yes right from second last row has no value, I want to value from which has value In that scenario which row has value some time it come last row or second last row or third last row so that scenario which logic is working
Then remove the if condition to check for Empty and use -1 or -2 instead in the filter datatable activity include one more filter with currentItem.ColumnName IsNotEmpty
This will filter the blanks also and last non blank will be retrieved using filteredfdt.rowcount-1
if all rows also will be blank is a condition then first check if filteredrowcount>0 then perform the assign
cheers