Can I use variable from last run to new run?

Hi,

Can you help me in writing logic :
I have 3 batches say - 001,002,003. If the batch is selected for the first time when I run the automation it has the right to write but if it is selected for the second time it has the right to review it when I run the automation for second time.
Example :
1 st time selected - 001 (write access )
2nd time selected - 001 (review access )
3rd time selected - 002 (write access )
4th time selected - 003 (wite access)

For any batch, the 1st time selected is write access and for the same batch if I select for 5 time it should only review.

Please help me with this logic

Thanks

Hi @garima.sriv12

Try this,
variables:
batchCounter (dictionary of string, int32)
currentBatch (string)
accessType (string)

then

logic:
if batchCounter.containskey(currentBatch) then
batchCounter(currentBatch) = batchCounter(currentBatch) + 1
accessType = “review”
else
batchCounter.add(currentBatch, 1)
accessType = “write”
end

If you mean between Jobs, you cannot pass a variable across Jobs. You can use an Asset for this.

1 Like

If I use Excel then ?

Can you explain this. I did not get

@garima.sriv12

Yes you can use excel as well.

Write the value in excel from last run, then check in next run it’s value and take corresponding action.