If statement in an Assign, can't get my two int values to add up

Hi all!

I have a variable called dr_test with type DataRow. In that variable, I am looking for a specific column in my DT to perform an arithmetic operation. I do this in my assign, in my ‘to’ value I put down: dr_test("TestColumn").

In the value of the Assign, I have put down the following If statement:

If(String.IsNullOrEmpty(dr_test("TestColumn").ToString), "0", in_TestItem1.ToString + in_TestItem2.ToString)

Right now what this statement does is add the values of TestItem1 (type Int) and TestItem2 (tpye Int) together. So, for example, if TestItem1 has the value of 3 and TestItem2 has the value of 0, the output will be 30. However, I don’t want this to happen. I want them to be calculated together.

My problem is: if I remove ‘to.String’ after TestItem1 and TestItem2, I get the error ‘‘cannot find general type’’ (this is roughly translated, I don’t know what the error actually looks like in English since my UiPath isn’t set in English).

I feel like I’ve tried everything but I’m stuck here. Any help would be appreciated!

Hi @Nomad ,

Could you change the Expression to the below and Check :

If(String.IsNullOrEmpty(dr_test("TestColumn").ToString), 0, in_TestItem1 + in_TestItem2)

Yes it worked!! I feel so stupid haha. Thank you so much!

1 Like

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