Hi Utkarsh, if you want to use Python package, you can build an automation process to invoke a Python script which defines two operations, Add and Subtract. One of the methods, Add, is then called from the script and given a list of integer variables as input parameters. The result then, stored in a PythonObject variable, is then converted into a .NET datatype to be further used in Studio. Follow these steps to build this demo:
- Open Studio and start a new Process.
- Drag a Python Scope activity to the Workflow Designer. Specify the installation directory of Python in the Path property of the Python Scope activity.
- Drag a Load Python Script activity in the Do section of the Python Scope and add the file path to the MathOperations.py (create a python file) Python script in the File property.
- Create a new PythonObject variable, called MathFunctions and add it into the Result property field.
- Add an Invoke Python Method activity and configure its properties as follows:
- Input Parameters - {2,3}
- Instance - Add the variable created at step 5, MathFunctions, to this field.
- Name - Add the name of the method inside the script you want to use, in this case add.
- Result - Create a new PythonObject variable, called SumResultPython, and add it to this property field.
- Next, drag a Get Python Object activity to the workflow. Configure its properties as follows:
- Python Object - Add the SumResultPython variable to this field.
- TypeArgument - Select Int32 from the drop-down list.
- Result - Create a new Int32 variable, called Result and add it to this field.
- Add a Message Box activity at the end of the project and configure it to display the Result variable.