For Each command issue when using text file

Hello Team,

I have one text file more than 10k lines. I want check first 100 lines I have my error details.
I am using If condition inside for each buts it’s taking all 10k lines.

I want execute only first 100 lines.

Any help on this.

Thank you.

@yogavalli, Can you post screenshot of your workflow?

Cheers

Hello there,
You can try this:
You can create a new variable, lets say named “counter”. This should be an int32. After that you can go and check the “For each” action. If you look at the properties(usually in the right side of the screen) you will see a field called “Index” under the Output. It looks like this:Screenshot 2020-04-11 at 13.28.33

Add the “counter” variable (without the quotation marks “”). This will memorise the index inside the “counter” variable. Dont forget to make the FOR EACH type argument as a string. That can be found in the properties panel as well.

You can use this condition “counter<100”(without the quotation marks “”) in your IF . To make it stop at line 100 you can place a break activity in the ELSE.(search for “break” in activities). In the THEN side you can check whatever you are trying to do.
It should look like this:

Hope this helps

1 Like

Thank you @Enache_Andrei.

Working great.

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