Get row item and process the data retrieved

Alex,

I am trying to process a data base.
The idea is that if an item from colulmn A contains a certain word (let’s say “bar”), it should read the data of column B (an integer)

My problem is just to understand how to write the condition in an if activity ? When I write Variable1.contains(“bar”), I get an error as it’s a generic value variable and not string.
It doesn’t work with Variable1.ToString.contains(“bar”) either …

Furthermore, if the condition is met multiple times through the database, it should add the values of column O and no overwrite them.

Any input on that ?

Bets regards,

Thomas

Hi @lemoinethomas

Please have a look at the attached xaml file. Hope this should help you to achieve what you want.

My sample database.

reading-row-values.xaml (10.7 KB)

Hello,

I’m very sorry but the attached file says “Activities could not be loaded but of errors in XAML”.

Anyway, I think my problem comes from the fact that i have Null values in some rows of my database and that’s why it can’t go trough it with a éfor each row" activity.

During the Foreach, when no value send to the variable, do you know how to get to the next row and continue the loop ?

Best regards,
Thomas

Hi @lemoinethomas

I added some null values in my database as well, as shown in the screenshot below. The workflow that i shared in my previous reply still holds good.

Regards,
Gourav

Thank you very much but the problem is your attached file says “Activities could not be loaded but of errors in XAML”…

@lemoinethomas , i am assuming it would be throwing an error while establishing connection to the database. Below is the screenshot of the For each loop. Dt1 is the datatable for me.

Thank you very much ! Works like a charm.

Do you know if there is a way for my to write this info in a cell from another excel file ?
This trick would be be to add the values in that cell.
In your example, it would be to write in a cell the sum of the ages of all the people whose name starts with “A” for example.

@lemoinethomas . Please use the below code snippets

After this you need to use write range activity to write the value (a/c) in the excel file.

Regards,
Gourav

Thank you very much for the info, could you please screenshot the write range activity ?

Best regards,
Thomas

Could you please screenshot the write range activity ? I’m still stuck at this point …

Best regards,
Thomas

Hi @lemoinethomas
Please use " Write Cell" activity.

Regards,
Gourav

Tahnks but it still doesn’t work for me …
“c” is an integer32 variable right ? It’s default value should be set to 1 ?

I seem to have a lot of issues between types of variables … My row seems to read value in String only.

read DT.xaml (10.7 KB)

read DT.xaml (11.6 KB)

Please find the attached xaml with the required changes.

Thank you very much for your efforts and time but it still has the same problem as before.

For the assign Activity of a =Convert.ToInt32(row(8)), i get the following error …

Please ensure the variable type is “int32”. In your xaml i saw that it was set to string. Please change the same.

I did before repying and it’s still the same Error …

read DT.xaml (12.8 KB)

I think it may have to to do with the type of data i’m reading (csv) ? Because it seems to work with excel files

Furthermore, I think you misunderstood what I wanted when I said “it would be to write in a cell the sum of the ages of all the people”.

I don’t want to do an average but add (+) the ages so “a/c” doesn’t seem suited for this …

Hi @lemoinethomas - yes you are right. I considered it to be an average. And in that case a\c is actually not required.

However, i think the problem that you are facing is because of the some variable type. Please verify the variable type of all the variables.

Regards,
Gourav

Hi @lemoinethomas

Can you please update the value that is assigned to the variable “a” as shown in the below screenshot.

Let me know if it works.

Regards,
Gourav