Altair RISE
A program to recognize and reward our most engaged community members
Nominate Yourself Now!
Home
Discussions
Community Q&A
How to use a counter to count the numbers of times loop_2 ran if its inside a loop_1.
Himanshu_Pant
I have a loop: loop example (loop_21). Inside that I have a simple loop (loop_2 ). I want keep a counter inside loop_2 and append the output.
For Example: Loop_1 runs three times and loop_2 runs four times. So I want count = 1, count = 2, count = 3, .......upto, count = 12
Find more posts tagged with
AI Studio
Accepted answers
JEdward
Have a look at your loop (Loop 2) operator do you have the box "Enable Parallel Execution" ticked? This may throw off your counter as the loop will be executing in multiple threads. If you uncheck this box it will perform one loop and then the next one, this should resolve your issue.
MartinLiebig
Hi,
that's likely because of the parallel execution? Did you try to turn it off?
Best,
Martin
All comments
MartinLiebig
Can you just use the macro %{a} which gives you the current execution count of an operator?
BR,
Martin
Himanshu_Pant
If I am putting it in first loop, its working fine. But in second loop counter is not proper its going 1, 2 then 4 then 3 then 5...
JEdward
Have a look at your loop (Loop 2) operator do you have the box "Enable Parallel Execution" ticked? This may throw off your counter as the loop will be executing in multiple threads. If you uncheck this box it will perform one loop and then the next one, this should resolve your issue.
MartinLiebig
Hi,
that's likely because of the parallel execution? Did you try to turn it off?
Best,
Martin
Himanshu_Pant
Yes, I did. It worked. Thank you.
Quick Links
All Categories
Recent Discussions
Activity
Unanswered
日本語 (Japanese)
한국어(Korean)
Groups