Hi all,
I have this Excel table
I need to verify if the difference between A and B columns is equal to C or not except the last row.
Note : No. of rows varies. It is not fixed.
Please help me with the logic
Thanks in Advance
Hi all,
I have this Excel table
I need to verify if the difference between A and B columns is equal to C or not except the last row.
Note : No. of rows varies. It is not fixed.
Please help me with the logic
Thanks in Advance
CurrentRow IsNot dt.AsEnumerable.Last
Cint(CurrentRow("B").ToString.Trim)-Cint(CurrentRow("A").ToString.Trim) = Cint(CurrentRow("C").ToString.Trim)
Hi,
Thanks for your response
Does this code ignore negative values?
Because sometimes 3-5 gives -2 but it should consider as 2 only
In that case you will need to use Math.Abs().
Math.Abs(Cint(CurrentRow(“B”).ToString.Trim)-Cint(CurrentRow(“A”).ToString.Trim)) = Cint(CurrentRow(“C”).ToString.Trim)
Hi,
When I’m using Math.Abs(), It’s throwing error
One of the cell in your datatable is empty “”. CInt() doesn’t work of empty values. Could you show us your workflow?
Usually It’s a Salesforce Application where i need to verify whether the difference is correct or not.
So On every login, the values and the no. of rows changes.
Sometimes it can have empty values also.
Here is the workflow.
CalculateForecstedAttrition-Service.xaml (24.0 KB)
Also I need to extract only rows having + icon
I can’t open your workflow but if you have empty values you need to decide how to treat them.
E.g. if empty value, assume that it’s 0.
Create three variables A, B, C of type Double and assign them accordingly:
A = CDbl(If (CurrentRow("A").ToString.Trim = "", 0, CurrentRow("A").ToString.Trim))
B = CDbl(If (CurrentRow("B").ToString.Trim = "", 0, CurrentRow("B").ToString.Trim))
C = CDbl(If (CurrentRow("C").ToString.Trim = "", 0, CurrentRow("C").ToString.Trim))
Then change the If statement to compare the difference to:
Math.Abs(B-A) = C