I am new to UiPath. I am trying to have a condition where cost centre equals to ‘123456’ and also the Sub-Dept equals to Dept.
Under Activities ‘If’, I have input the condition as: cint(CostCentre).Equals(“123456”) and row(“Sub-Dept”).ToString.ToUpper = row2(“Dept”).toString.ToUpper
I have gotten error : Compiler errors encountered processing expression “cint(CostCentre).Equals(“123456”) and row(“Sub-Dept”).ToString.ToUpper = row2(“Dept”).toString.ToUpper”.
Value of type ‘System.Data.Data.Table’ cannot be converted to ‘integer’
Welcome to the Community !
I’m totally confused with the which variable belongs to which data type. Looking at the error you have some datatable you are refering to it as a string in the code. I will make some assumptions & give you some details:
- You have a DataTable with Cost Centre , Sub-Dept, Dept as Columns (with the same exact coumn names). This is in a variable named CompanyDetailsDt
- Data in Cost Centre , Sub-Dept, Dept as Columns both are in string format (if they are not it better to treat them as string. Bcos a cost center can have the number 002. if you consider this as integer we will land into trouble)
- Use a for each row activity to loop though CompanyDetailsDt
- In the IF Condition write:
row("Cost Centre").ToString.Equals("123456") and row(“Sub-Dept”).ToString.ToUpper = row2(“Dept”).toString.ToUpper
Hope this helps. Kudos
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.