Examples of use - Functions
Export steps from process to Function
Now we will provide an example of how to create a new function from part of the process. In this example, we will use the process that we created in the Examples of Use - Date and Time steps. To do this, we will select all the steps we want to export to a function and click on the "Export to Function" button.
Now, provide a name for the function and then proceed back in the process to search for that particular function.
Click on "Define Function Step" and add input/output parameters as needed.
First, we will add two input parameters: one for the Integer value of the number of days we want to add, and the other a DateTime parameter for the subtract date.
And now add to that two steps parameters instead fixed values.
After adding input parameters, we will also include one output parameter for date as a string.
Update the value to the output parameter. Save the Function and proceed to create a new process in which we will use this Function.
Executing Function
First, we will create a new string variable and pass it as an input parameter to our function. Then, using the Get Current Date Step, we will save the current date to a DateTime variable and pass it to the output function variable.
Now, select the Execute Function Step and fill out the parameters. For the first input parameter, use AddDays and for the other parameters, use variables.
After running the process, the output string variable will contain the value from our Function.
Create new Function from beginning
if you want to create a new function from the beginning, simply go to the function menu and click "Create function".
Now everything is the same as already explained.