Writing conditional statements


I am very new to UiPath and had a question about conditional if/then statements.

I have a large excel file (93,600 rows) of data. The columns are Employee Name, Manager Name, Report Submission Date (mm/dd/yyyy hh/mm/ss), Report Name, Purpose, City, Expense Type, Transaction Date (mm/dd/yyyy hh/mm/ss), vendor, payment type, personal expense, and expense amount.

I am attaching a sample of the excel sheet below.
dummy variables.xlsx (9.9 KB)

I am going to load this dataset into UiPath and then run a series of tests on this data. I want to run tests like

If Expense Type = (“Parking”) AND Expense Amount > $50
If Payment Type <> Cash AND Expense Type does not contain (“Air”)
IF report date>transaction date by 15 days

For the Then condition, I want to export these rows into a new table, then for the else condition, I want to leave the rows where they are.

Thank you!

@hall1570WritingConditionalStatement.zip (20.3 KB) Download the Zip file and Run

Excellent use of UiPath! I’m having some trouble converting it to my usage though. On the assign variables sequence, there is a variable there that is not working. For Transaction date, it is giving me the following error:

Cannot assign from type ‘System.String’ to type ‘UiPath.Core.GenericValue’ in Assign activity ’ Assign’.

In the data table, there is no column titled TransactionDate, I had to add a space between the two words to get UiPath to recognize the column.

The code I am using for the value of the assign activity is: row(“Transaction Date”).ToString

It’s obvious that it’s not working because the Transaction Date variable is not a string but rather a datetime. I’m adding a screen clipping of the Transaction Date variable.

I tried changing the variable type to a DateTime variable and I also tried removing .ToString from the actual assign coding.

Neither of them worked and the new error I am getting is:Cannot assign from type ‘System.Object’ to type ’ System.DateTime’ in Assign Activity ‘Assign’

Cut the Values and Re-paste it.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.