Hello,
I have a use case to compare two cols in a excel sheet, then if the 2 columns are equal, then I want to:
*create a new column ( pass/fail) and write a new Excel file with the initial data and the new column.
I have created a workflow(see below) to do it, but my expected result is not valid. I expect to get something like this:
workflow:
expected result
but my actual result from my workflow is:
The logic doing the comparison is:
I know I’m missing something in the ELSE part of the IF
Attached is my workflow
assertWithinEXCELColumns (2).zip (20.8 KB)
Anil_G
(Anil Gorthi)
April 24, 2024, 4:25pm
2
@Yomi_Oluwadara
You can use this in invoke code by sending dt as in/out…before that make sure to add column as you need
Dt.AsEnumerable.ToList.ForEach(Sub(r) r("NewColumn") = If(r("firststatus").ToString.Equals(r("Secondstatus").ToString),"Pass","Fail"))
Cheers
1 Like
lrtetala
(Lakshman Reddy)
April 24, 2024, 4:26pm
3
Hi @Yomi_Oluwadara
Try this
(From row In dt.AsEnumerable()
Let firstStatus = Convert.ToDouble(row("firststatus"))
Let secondStatus = Convert.ToDouble(row("secondstatus"))
Let passFail = If(firstStatus = secondStatus, "Pass", "Fail")
Select dt.Clone().Rows.Add(row("studId"), row("firststatus"), row("secondstatus"), passFail)).CopyToDataTable()
Regards,
1 Like
lrtetala
(Lakshman Reddy)
April 24, 2024, 4:29pm
4
@Yomi_Oluwadara
(From row In dt.AsEnumerable()
Let firstStatus = Convert.ToDouble(row("firststatus"))
Let secondStatus = Convert.ToDouble(row("secondstatus"))
Let passFail = If(firstStatus = secondStatus, "Pass", "Fail")
Select dt.Clone().Rows.Add(row("studId"), row("firststatus"), row("secondstatus"), passFail)).CopyToDataTable()
Input:
Output:
Regards,
1 Like
vrdabberu
(Varunraj Dabberu)
April 24, 2024, 4:29pm
5
Hi @Yomi_Oluwadara
I have made the required changes in your flow. Please check the below zip file.
assertWithinEXCELColumns.zip (119.0 KB)
Output:
Let me know if you have any queries.
Regards
1 Like
@Anil_G @lrtetala and @vrdabberu Thank you all for the insights. Appreciate it.
3 Likes
system
(system)
Closed
April 27, 2024, 6:12pm
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.