Assign Activity Error Cannot Perform "=" operation Error

Hi, @jack.chan

I have datarow variable called drCommon and I am assigning it a value froom the Datable Output_DB as

image
(cmnString is a variable of String Type which holds the value 25)

While doing this I am getting an Error as :

image

Can anyone suggest me something on this ?

Hi @Ishan_Shelke

The error message you should get is below, because datatable.select() always returns array of data row. which you cannot assign to a data row variable.

image

But you got different error message. could you please check the variable data type of drCommon and Ouput_DB

image

You should use row index position to assign

Output_DB.Select(cmnString).ElementAt(rowIndx)

(cmnString is a variable of String Type which holds the value 25)

Your select query format is wrong, it should have column name in the query, operator and the filter value.

Please refer to this post for filtering data table

Four Ways to Filter Data Tables in UiPath Studio | UiPath

Thanks
John

(post deleted by author)

Hello @Ishan_Shelke ,

You are trying to assign collection of rows to a row type variable, which is not possible. Use the method suggested by @johnfelix

Thanks,
Sanjit

Here as far as I can see the variable type is Array of Datarow which should eventually work

Output_DB is a datatable type of variable

Past 1 month, this was working fine this error popped up today

Okay, as per your suggesstion I modified the following cmnString variable to but it’s still not working

Your error message, code and the screenshot does not sync logically.
So not sure why this error message appearing now.

Have you recently updated any package versions? if so, then please downgrade packages to older version and try again.

Hi @Ishan_Shelke

You code should look like below

Output_DB.Select(“[Dealer Code] ='”+row(0).ToString.Trim+“'”)

Please check row(0).ToString.Trim has value in it.

Ok I’ll try to Explain More Clearly

I have a excel file named A which has columns named Dealer Code, Dealer Name, and City and I am reading it with a read range and storing into a datable called Output_DB

I have another Excel file named B which also contains the Column Dealer Code, Dealer Name and City.

What I am trying to do is, If the dealer Code in sheet B is also present in the sheet A then I am picking the Whole Row of Sheet A and storing it into a Datable

To pick the Dealer Code of Sheet B I am using the Following Code Snippet.

and to search for the Rows in the Sheet A I am trying to use the following code snippet

image

Doing so I am getting the above following Error mentioned in my First post

@Ishan_Shelke
change Output_DB.Select(cmnString)

to
Output_DB.Select(cmnString)(0)

because Select function returns array of datarows whereas drCommon is a single datarow variable

Hi @Ishan_Shelke

I am unable to figure out the issue.

Our previously discussed solutions should work but, in your case, it’s not working

Excel A / Sheet A - Output_DB

Excel B / Sheet B - dt_Sheet_B

So here is the different approach to get same results

Approach 1 - Using Merge data table

image

Excel_Data_Filter_Approach_1.xaml (18.8 KB)

Approach 2 - Using Filter data table

image

out_dt_Output

image

Excel_Data_Filter_Approach_2.xaml (18.8 KB)

Points to note:

  1. Used clone method to copy the header from Output_DB to dt_Temp
  2. Used dt_Temp to store filtered rows from Output_DB
  3. These two approaches have output in data table data type instead of data row / array of data row data type
  4. Output Data Table activity is used for debugging purpose and not applicable to your requirement

Please let us know if you are still facing the error.

Thanks
John

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