Flow decision error while looping the data

Hello everyone, I’m reading some numeric data from Excel and I’m looping it till the condition satisfied but my bot is stopping after 1 loop and it’s showing error can anyone help me .

Read cell output stored as (System.Double)

I want to loop that excel data till it satisfies the flow decision condition but I’m getting error after looping it once

This is the error I’m getting
Can anyone help me how to solve this

Hi,

I suppose condition of the Flow Decision should be count<3 ?

or also should increment read1.

Regards,

Hi @Yoichi I incremented that in write range I attached that flow screenshot . It is incrementing 1 time after going to second time it’s showing error.

Hi,

In this case, read1 is not incremented. You need to write read1 = read1 +1 in Assign activity like count.

Can you try to run Debug? Then you can check value of each variable at locals panel, if exception is thrown.

Regards,

Hi,

Sorry for i had a little misunderstanding.

read1 is int32 variable to store cell’s value, right? Then,read1 is not need to increment.

This error is caused by assigning empty (null) to Int32 variable (read1) when read from A5 cell.
Do you need to read from A5 cell?
If not, you need to change condition of decision flow like count <3 ( or 4,5), to not read from A5,

Regards,

@Yoichi please check this

Sequence4.xaml (11.2 KB) temp.xlsx (8.1 KB)

Hi,

Thank you for sharing your workflow and data.
I just run debug and the following is result.

After bot writes cell A4, count is incremented as count=4. Next bot try to read A5 cell.
As I mentioned, it stops because A5 is blank and assigning to double variable

Can you share what result you expect?

Regards,

@Yoichi I want to retry the bot till the retry count becomes 3

My starting cell value is 1 and bot need to retry till the cell value becomes 3

Hi,

Can you try to add the following If activity after count = count +1?
count should be assigned 1 if it’s larger than 3.

Regards,

Thanks @Yoichi I will check this

@Yoichi it’s working fine for only 3 rows , but I want it for multiple rows and I don’t know how many rows will be in that excel

Hi,

If you want to handle it dynamically, mainly there are 2 ways as the following.

  1. Get count of items using ReadColumn Activity in advance. Next, check whether count is larger than it.

  2. Get cell value as not Double type value but GenericValue type in Read Cell activity.
    Then, check whether the value is empty or not. If value is empty, count should be assigned 1.
    If not empty, count should be assigned Double.Parse(cellVlue.ToString())

Former sample is the following.

Sequence4.xaml (14.7 KB)

Regards,

Apparenly you need two loops:
1/ loop1 (outer loop) stepping through rows until the empty cell
2/ loop2 (inner loop) incrementing valu of the cell until < 3

Cheers

@Yoichi i’m not able to open it properly version issue i think that activities showing error , if you can please share me screenshots.

thanks @J0ska i will try this

Hi,

Hope the following helps you.

img20201126-4-1

img20201126-4-3

Regards,

1 Like

Thanks @Yoichi it’s working. Thank you for your help.

1 Like

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