Yarado Tasks can grow big and complex very fast. Especially equations and business rules make it harder to maintain created tasks. The Solution for this is to split logic pieces of the main task into SubTasks
Reasons to use SubTasks
- Reduce Complexity
- Improve manageability
A logic piece of an Auction task is to manage the height of the bid to have a great change to win the Auction. Variables are passed from the main task to the sub-task, and vise versa.
A maximum limit is set to prevent overbidding our budget. A raise level is included to raise for a specific minimum to shake of minimal bidders.
function names in this example uses the updated function names. Use the translation list to lookup the older function names in old to new old function names are included between  for easier readability
Add step Add or Subtract [Add x]
Add Step Compare Variables [Greater Than]
Add Step Advanced If
Add Step Set Variable Value [Copy to] Copy new bid value to return Value
Click on the first Column to activate it again check if column arrows turn green
Then Add Step Set Variable Value [Copy to] copy maximum bid value to return value
Save the Task
Create a new task that serves as main and add variables
Add Step SubTask
Click Browse and select the name of the subtask created above. After selecting the tasks all global variables are indexed and displayed into the Name Value section. Right click in the value fields to link the variables to the main task. linking will pass current value from main to sub and retrieve the value from sub back to main.
link all SubTask variables to main variables by Right Clicking in the value field. Select from user variables.
|Subtask Variable||MainTask variable|
Save Task as Main_AuctionBid.tsk in the same folder as the subtask is located
Start the Task to check if the function is created successful
CurrentBid + BidRaise < Bid Maximum then bid now should be 24
Change the auction bid value to an amount higher than maximum and start the task again.
CurrentBid + BidRaise > Bid Maximum then bid now should be Maximum Bid = 25
Play Around with the values.