Hello, I’m encountering an issue related to the REF.
My goal is to send an email at the conclusion of the REF process, containing all the information that the robot has discovered. For instance, within the process section, I have a variable of type ‘int’ whose purpose is to increment by 1 with each iteration, as there is new data to process from ‘gretTransactionData.’ Ultimately, the email should read something like this: "The robot has found (variable) books.
But every time the robot iterates because there still data to process, the information stored in the variable is deleted. So the email text is always “The robot has found 0 books.”
the reason why the variable is being deleted is because the REF process is restarted after each iteration. This means that all of the variables in the REF process are reset to their initial values.
To fix this issue, you can use a global variable to store the number of books that the robot has found. Global variables are not reset when the REF process is restarted, so they can be used to store data that needs to be persisted between iterations.
Something like this
`// Create a global variable to store the number of books that the robot has found.
GlobalVariable numberOfBooksFound = 0;
// In the REF process, increment the numberOfBooksFound variable by 1 for each book that is found.
numberOfBooksFound++;
// At the end of the REF process, send an email with the number of books that the robot has found.
SendEmail(“The robot has found " + numberOfBooksFound.ToString() + " books.”);`
Or u can prefer using queues where add the data first and pick them one by one so that new item will be picked without issues
Queues are not reset when the REF process is restarted, so they can be used to store data that needs to be persisted between iterations.