How do I create a for each row if statement so that it writes "No Payment" in blanks

pay

I also want to create a message box that will say “[name] has not paid yet.” or “[name] has paid” when I input their first name

Hey @Shana_Park ,

Try the below if condition, Hope this works. I tried this for sample file and it worked for me. Let me know if you face any challenges.

string.IsNullOrEmpty(CurrentRow.Item(“Payment”).ToString) orelse CurrentRow.Item(“Payment”) is Nothing

Logic :
For each CurrentRow in DT
If (string.IsNullOrEmpty(CurrentRow.Item(“Payment”).ToString) orelse CurrentRow.Item(“Payment”) is Nothing) Excel Op.zip (13.9 KB)
Then

  CurrentRow.Item("Payment") = "No Payment"

As per my understanding on your second query, i created 1 sample xml file, do check out and let me know if they are as per your requirement.

1 Like

Hi, Thank you!
It says currentrow is not defined…
also, What activity do I put in the “Then” box so that it writes in the cell?

1)read the table into a data table using read range and assign it to DT variable
2)take input from user and store it into another variable say str_FirstName
3)assign a datatable variable say dt_Filter to DT.Asenumerable.Where(Function(x) x(“First Name”).tostring.contains(str_FirstName)).copytodatatable
4)use a if block with the condition dt_Filter(0)(“Pay Amount”).tostring is Nothing
5)in then block add message box with text as dt_Filter(0)(“First Name”).tostring+" has not paid yet."
6)in else block add message box with text as dt_Filter(0)(“First Name”).tostring+" has paid"

Hi @Shana_Park

Try row instead of currentrow.

Ex:

Instead of,

CurrentRow.Item(“Payment”) = “No Payment”

Try like this,

Row.Item(“Payment”) = “No Payment”

Thanks

Hey @Shana_Park ,

The CurrentRow is a variable of Foreach-Datatable activity. in the new version (2021.10.3) the for each activity variable by default given as “currentRow”. If you are using old version of UiPath studio, then it must be “item”. Below attached screenshot for reference

Hey, I’m new to RPA, and oh my god, I think this is what I’m looking for. Only difference is that instead of Payment column I have total invoice amount.

1 Like

Hey @Kavya_Bhat ,

Please try and let me know if you face any challenges

1 Like

Thank you, it worked for me