One simple question, if i change the direction of Out_C to in/out where should i declare the value as 2
Hopefully this makes you understand better:
OUT Arguments => where the value originates and will get reset
IN Arguments => where the value is used but “not” changed and does not need to exit .xaml
IN/OUT Arguments => where the value is used and changed, then returned so it can be used again.
So, you must think about that when deciding what direction an argument will have.
It’s best practice for transactional counters though to be changed outside the Process .xaml
For example,
Main.xaml
INIT state
GetData.xaml : pass out initial counter value if needed
Get Transaction State
counter = counter + 1
Process State
Invoke .xaml : pass counter as IN direction
Go to Get Transaction State to get next counter/transaction to process
If your counter is being changed within the Process .xaml then your argument will be slightly different
Like this:
Main.xaml
INIT state
GetData.xaml : pass out initial counter value if needed
Get Transaction State
Process State
Invoke .xaml : pass counter as IN/OUT direction
Go to Get Transaction State to get next transaction to process
If you choose the second approach and your argument is sent to multiple .xamls, then those also need to be IN/OUT
Main.xaml
INIT state
GetData.xaml : pass out initial counter value if needed
Get Transaction State
counter = counter + 1
Process State
Invoke .xaml : pass counter as IN/OUT direction
Invoke .xaml : pass counter as IN/OUT direction
Go to Get Transaction State to get next counter/transaction to process
(notice both arguments in Process.xaml and Create_SO.xaml would need to be IN/OUT, since it will exit out of the Process state, go to Get Transaction State, then return back to Process state, so the IN/OUT allows it to maintain the changed value)
If you use the first approach where the counter is added inside the Get Transaction State (instead of the Create_SO .xmal), then those can just be IN directions.
Also, if it helps, running step by step in Debug will show how the values are changed during the run, so you can identify where the value gets reset, which most of the time is with the scope or argument direction.
Regards.
Thanks a lot Clayton for detailed information.It helped a lot.
The problem is resolved.
I am facing a challenge, where I have to increment value inside for each. I have used count variable so it is incrementing but bot is still stuck a first row only, it is not going to the second row.
Can you guys help me on this ?
hi clayton
my project is to make search of specific number from my excel in a specific website and getting some information from each page i enter
but after doing the search 5 times the system lag so i desided to make my robot after every 5 searching process happened is to reopen the system again
and i did the same with the counter you mentioned and i used if activity so that when the counter reach 5 it open the system again
but when it reached the 5 the robot kept opening the system for every row from my excel without doing the process again which is taking specific info
do you know how to do it ?
Hi.
There are probably a few different ways to do this.
-
One method would be to identify some timeout or error from the web application, then simply handle it like an error where you log a warning and close the application, then return to the last transaction or row again.
-
this approach is the most dynamic
-
the project will need to be designed to handle each row like a transaction so the error can be handled and continue on the current row item. I recommend a variation of the ReFramework, but it is not required
here is what the logic for method #1 might look like:
-
Initialize
Close Application(s)
Load Application(s)
Get Dataset, first time only
Get Transaction or row item from dataset, if null
Try/Catch, capture errors
Process transaction
Go to get next transaction (set transaction to null), or go to Initialize if error occurs
you can also use a For Loop for method #1 like this:
Get Dataset
Load Application(s)
For each row item
Retry activity
Try/catch, capture error
Process row item //search etc
Catch
Close Application
Load Application
Rethrow
-
The other method would be to hard-code the retry mechanism which is what it seems you were attempting to accomplish
-
not the most dynamic nor efficient
-
there are two ways to do this: use a counter or split the dataset into groups to loop through
- let’s assume you use a counter; here is what the logic would look like:
-
For each row item
IF counter = maxcount
Close Application
Load Application
Process row item //search etc
counter = counter + 1
Hope these suggestions and examples help.
Regards.
Why did you not use the index value in the Properties of “For Each”?