Assign Date to a variable and use it in UiPath

2.2k views Asked by At

I need to extract the data of employees from an Excel sheet. The Excel sheet contains the DoB and I need to assign salary according to the DoB. The person born before 1995 will be credited a salary of 50000 and person born after 1995 will be credited a salary of 20000.

I had tried and there was an issue with the date.

UiPath Studio

1

There are 1 answers

0
Ilya Kochetov On BEST ANSWER

Filtering like the one you need could be done using LINQ but if you are new to VB.NET this may be a little bit too complex approach. I would suggest using For Each Row cycle to go throuh each DataTable row and use VB.NET DateTime.CompareTo method for comparing two dates (DOB from Excel and 1/1/1996). You already have the IF statement in your workflow, just use Assign activity to set the salary column, like this: Left part of the Assign: row("salary") Right part of the Assign: 50000 (or 20000) Then you could save your calculation back to Excel by using Write Range activity