Using Output activities and Output Methods - Part 3

I followed the steps exactly but I’m not sure why only C2 is being written in and not incrementing to the next row.

Input Methods and Input Activities.zip (637.9 KB)

Hi @wendy.xiongm

I was not able to run your flow, but could analyze it.

Here is what is happening in my view:

  • Your rownumber variable’s scope is “Body” of for each loop and you have set its default value as 1, that’s why everytime forloop runs, it is getting initialized to 1 thus bot is writing in C2 everytime.

Do this instead:

  1. Change the scope of variable to Do or outer sequence.
  2. Then have an assisgn statement outside of for each loop. You can have it right after read range activity. Assign Rownumber =1 there.
  3. Then rownumber will retain its value.

Hope this helps.

Regards
Sonali

2 Likes

Hey @wendy.xiong
The issue is that although RowNumber is initialized with the value 1, its scope is set to Body, meaning it’s recreated from scratch in every loop iteration. As a result, the assignment RowNumber = RowNumber + 1 doesn’t persist between rows, and the value keeps resetting to 1.
That’s why the data is always written to the same cell, C2. To fix this, simply change the scope of the RowNumber variable from Body to Do, so that the incremented value is remembered across iterations.
Input Methods and Input Activities (2).zip (639.6 KB)

2 Likes

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