Needs one number decreasing everytime

Hi, Ex. Let I have 10 rows in the excel, and I am fetching this data and writing in abc application.
So simple I want everytime 1 number reduction.
Suppose I have variable RowsCount first it contains 10 values bcz I have 10 rows in an excel. when 2nd rows fetching data and writing then it will be 9 value and so on. when it completed 10 rows then RowsCount will be 0.
@Palaniyappan @KarthikByggari @Lahiru.Fernando can you tell me

1 Like

simple
–hope you have the datatable ready named outdt
–use a for each row loop and pass the above variable as input
–inside at last all the activities inside the loop use a assign activity like this
Counter = outdt.Rows.Count
then another assign
Counter = Counter - 1
where Counter is a int32 variable
so the Final value will be 0 once the for each row loop ends
Cheers @balkishan

1 Like

Bro @Palaniyappan is As I read 5 rows data for testing purpose and I am not writing anywhere, Just check wheather the counter value decrasing or not. Here initial counter was 4 then second run time 4 then 4 then 4 and so on. so may I know It’s writing the same number bcz I am not writing the data anywhere or what. suppose it should decrease the value.


image

1 Like

Hi @balkishan

Can you check the scope of the counter variable. Make sure it is not limited to the Body scope of the for each row activity. Scope should be something outside it. If not, it will not change the value as expected…

1 Like

kindly mention the first assign of
counter = outDT.Rows.Count
before to the for each row
Cheers @balkishan

3 Likes

@Lahiru.Fernando see bro how I have made as @Palaniyappan suggested me. I have taken the output parameter counter1.


Here I am not writing anything inside the loops just put the simple logic to get the current value. But I got the 4 value. in the invoked workflow.
see I got the 4 value.

1 Like

Hi
kindly mention the first assign of
counter = outDT.Rows.Count
before to the for each row
as it is inside the for each row loop each time it will show as 4 only
kindly mention that before the for each row loop and remaning same
we will be getting the right one by one decrementing value
Cheers @balkishan

Thanks @Palaniyappan & @Lahiru.Fernando it’s worked. when we count it before the loop.
image

2 Likes

Fantastic
Cheers @balkishan

1 Like

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