reset a counter in every iteraion of a loop - loops

I'm a new user of blueprism.
I'm using two loops in blueprism and using a increment a counter. After finishing one loop and going to another, I need to reset the counter value. Please help me in doing that.

Begin your loop, do your stuff in here and increment.
And right after the loop put a Calculation Stage and just save "0" to your incremented data item (the "reset" calc stage on the screenshot)

Related

JMeter Inner nested loop counter not resetting for subsequent loops

I basically have this structure - How to implement nested loop in jmeter?.
The outer loop works as it should. In my case, the outer loop executes 3 times and executes a SQL query each time.
The inner loop executions are based on the # of rows a query returns, so if the first query returns 10 rows, the inner loop execute 10 times. This works great for the 1st outer and inner loop execution. The problem is that the JMeter Counter object in the inner loop does not reset for the second query.
In other words, if the second query in the outer loop returned 5 rows of data, the Counter is still going to count from 1 to 10 based on the first query. Even worse, when it gets to the inner loop of the 3rd query, it's going to start at 6 and continue counting up to 10, then start all over again at 1.
The JMeter inner Loop Controller picks up the new count value and executes the correct number of times, but the query result data is written to a new DB based on an index # (i.e. 1 to #_of_records) so without this index #, I can't properly write out this data. Where p_cnt_tq below is the index # I referred to -
INSERT INTO TopQuery (Id,Database_name,Schema_name,sqltext,total,avg_duration,max_duration,avg_reads,max_reads,avg_writes,max_writes,avg_CPU_time,max_CPU_time) VALUES ("${p_max_id_1}","${_V(P_DbName${p_cnt_tq})}","${_V(P_SchemaName${p_cnt_tq})}","${_V(P_SqlText${p_cnt_tq})}","${_V(P_ExecCount${p_cnt_tq})}","${_V(P_AvgDuration${p_cnt_tq})}","${_V(P_MaxDuration${p_cnt_tq})}","${_V(P_AvgReads${p_cnt_tq})}","${_V(P_MaxReads${p_cnt_tq})}","${_V(P_AvgWrites${p_cnt_tq})}","${_V(P_MaxWrites${p_cnt_tq})}","${_V(P_AvgCpuTime${p_cnt_tq})}","${_V(P_MaxCpuTime${p_cnt_tq})}");
While this seems like it would be ridiculously easy to fix, I have not found a way to create a counter inside the inner loop that counts from 1 to the #_of_rows returned from each outer loop. Has anyone else run across and solved this puzzle?
enter image description here
Why do you call it "puzzle" and why do you expect the counter to "reset"? Have you tried to read the documentation?
Allows the user to create a counter that can be referenced anywhere in the Thread Group. The counter config lets the user configure a starting point, a maximum, and the increment. The counter will loop from the start to the max, and then start over with the start, continuing on like that until the test is ended.
You ticked the box to Reset counter on each Thread Group Iteration but "Outer" Loop Controller's iteration is not a Thread Group iteration
In general I fail to see why would you need to have this Counter at all, Loop Controller exposes a special JMeter Variable which returns the current iteration number.
JMeter will expose the looping index as a variable named __jm__<Name of your element>__idx. So for example, if your Loop Controller is named LC, then you can access the looping index through ${__jm__LC__idx}. Index starts at 0
It's zero-based but you can easily add 1 to it using __intSum() function

How to write to arrays using loops in PureData?

I'm writing random numbers in an array using loops in Pure Data. For some reason in loop one Pure Data starts writing from index 1 instead of 0 and finishes on index 0 after the loop, this is not what I want. In loop two I found a solution using an extra [f] and [bang], Pure Data does the expected, starting from index 0. In both cases console prints the data in the same order (numbers are random, the order is the same), just the graph, reflecting the array, is different.
Does anyone know why the first case fails and the second works? My guess is that its related to the flow of data into the left and right inlets of [tabwrite].
loop one
Code
Console
Graph (1.151 is on index 1 instead of index 0)
loop two
Code
Console
Graph (1.742 is correct on index 0)
Message order.
You have a fanning output on the [f] object. Use a trigger [t b f] (short for [trigger bang float]) to make the order explicit. If you see an atom with multiple connections on one output, that's a red flag! Always use trigger objects, because without them the order in which you made the connections will be the order in which the messages will be sent. That's not visible in the patch, so it should be avoided!
Read more about message order in the documentation of Pd
There is another issue in your patch. Consider this case: If NotasPor0it is 8 and the counter is at 6, then NotasPor0it is changed to 4, the select object [sel] will never trigger the reset function of the counter idiom and continue to count... To avoid this issue, you could use a 'larger as' [>] symbol, or solve it with modulo (%) as seen in the screenshot.

Start sequences by a trigger on Datastage

I am kind of new to Datastage and i have a requirement to trigger multiple sequences when a timestamp is updated at a certain time of the day.
1st Sequence - 1.It starts with a parallel job that generates a list of sequences that are meant to run. 3.Then the loop starts (numeric, 26 times), 4.inside the loop it execute the 2nd sequence. 5.Then it sleeps for 15m before ending the loop.
2nd Sequence - 1.Reads list of Sequences with execute command. 2.Another loop starts with the command output of the list. 3.Then i side the loop it executes a parallel job that will check the timestamp for each item on the list. Saves result on a file ("ok" if it meets a condition to do with the timestamp). 4.Reads the result of the previous parallel job.
This is when it starts not working.
Basically what i want it to do is in case the result is ok, it's meant to go ahead and execute the sequence for that item, otherwise it goes back to this loop and checks next item.
I cannot wait for the sequence to be over before it checks the next item on the list. The list has 7 items.
So, what i have is,after it reads the result i have a nested condition which indicates which sequence to go for depending on the loop counter.
It always performs the first one well but then it ends and instead of going to the next item on the list it says "startloop was started but it did not complete all its iterations".
Please note that when it reads the result, if its not "ok", it goes down to a sequencer (set to any) and then back to the loop).
One of two options here.
Use a Datastage Server routine to call the DataStage job you want without blocking.
Write a shell script that calls dsjob and doesn't block.

How to find out how many times each process(or data) traversed using array

Let there are 4 processes (20,30,40,50). I want to decrement 3 from each process when it is traversed first time, decrement 6 if it is traversed second time and remaining value when traversed third time.
constraint: *any process can be picked up randomly (ie not in a sequential manner).
you can use simple map as a counter to store the number of time an element of array is traversed and with simple if condition based on counter you can decrement the value of the element accordingly.
Through I'm little late, but you can try a hack.
For this what you'll need is either use mapping or a counter for each element of array.

Creating an XY graph in labview which would store previous values

Link to the vi: see xy_plot_problem_withcase
In the attached vi (xy_plot_problem_updated.vi) I am able to get 3 individual values x, y and z in an array, element 0 being x, element 1 being y and element 2 being z.
These three values come for every iteration of the outer while loop. I would like to store all generated x values into one array and same with y and z so I can use the final arrays to generate one final graph.
The outer while loop runs 30 times and I would like to record the 30 different values generated at index 0 in a separate array. I tried using a shift register, build array etc but its just replacing element 1 (of the new array) with the newest element generated (They are not getting accumulated).
I have encountered this problem while designing for a system which records 3 different readings for every 5 degree increase in temperature. I want to be able to plot the acquired values against the current temperature. Hence, the outer while loop is actually a case statement which gets triggered every time the temperature goes up by 5 degrees.
I have also attached the main VI too alongside (final.vi).
Any help appreciated!!
Thanks in advance!!!
In your final.vi you have a while loop, you should move everything in the case into the while loop. My advise for you would be to look at the LabVIEW fundamentals on data flow and on shift registers.
In your code you were resetting the shift register in the while loop every iteration.
Try to clean up your code and use the executing highlighting function (the light bulb).

Resources