How do I make UiPath write a like in a cell of a data table through an if statement?


I want to fill the blanks with “Not Paid”

so I currently have this but it’s not working.

I also want to create a message box where when someone inputs the last name, the bot checks if they have paid or have “Not Paid”, so that a nice message box with “first name + last name has/has not paid”

Hi @Shana_Park

Please try this,

For updating the blank with Not Paid,

Read the excel sheet data and store the data in the datatable variable name newmemberDt.

Drag and drop the invoke code activity.

In edit arguments, create a variable dt, set direction as in/out and pass value as newmemberDt

In edit code type the following,

dt.asenumerable.where(function(row) string.isnullorempty(row("Pay Amount").tostring)).tolist.foreach(sub(row) row(“Pay Amount”)= "Not Paid")

Write the datatable back into the excel using write range activity.

For the message box process,

Put this in IF condition

newmemberDt.asenumerable.Where(function(row) row("Last Name").tostring = memberName)(0)("Pay Amount").tostring = "Not Paid"

Before message box on both then and else part put an assign and give these,

memberName = newmemberDt.asenumerable.Where(function(row) row("Last Name").tostring = memberName)(0)("First Name").tostring + memberName