How to perform simple arithmetic operation with variable IEnumerable type?

Hello everyone !

My problem is simple, I have 4 variable with IEnumerable type because they are here for counting a “Find Image Matches” activity.

With this 4 variables I want to create two other variable I’ll put them in a excel latter.

Two variables need to be sum (A+B)=E and the two others need to be substracted (C-D)=F.

The problem is I can’t convert them with what I found on the forum or in the internet, I tried “CINT(variable(0))”, “Convert.ToInt32(variable)” or “Int.Parse(variable)” I tried to put them in a string and after in a int but this is not working aswell, I only get errors or the return of “AB” and not “A+B” (If it’s 5 and 6 I will get “56” instead of “11”)

This is the part of the xaml you’ll need but without the image so I let you find the number you want :

testt.xaml (12.8 KB)

In my case I want to sum “nbticketsStorm” + “nbticketsQuestion” and I want to substract “nbticketsP2 - nbticketsP1”.

After this I just have to return a int in another variable so I can add it in a excel file.

Thank you in advance

Try with nbticketsStorm.Count

It worked for me.
I created new variable type Int then I used Assign

intVariable = nbticketsStorm.Count

Then I added some values to intVariable and I got the desired results

1 Like

Hi @Ludo.F,

Kindly check this: Below code is from last message box in code:
(Convert.ToInt32(nbticketsStorm.Count) + Convert.ToInt32(nbticketsQuestion.Count)).ToString

Regards,
Sasikumar K

1 Like

Hi @srdjan.suc , thank you for your answer !

I tried to do it and it work in the message box but after I need to put the value of the message box in another variable because I need to use this value in a “Write Cell” activity and the output of the message box (or the method in the message) doesn’t work for the Write Cell.

So I tried the solution of @Sasi.lalo , thank you for your answer too !

His solution work like expected I can do my two operations with this by putting his method directly in the “Write Cell” activity so he got the point !

Regards

2 Likes

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