EvaluateEquation
You can use this function to enable the API integration with the application.
Purpose
The equations are executed using the API EvaluateEquation based on the provided equation code and input.
Syntax
string equationResult = EvaluateEquation(string equationCode, string inputJSON)
Arguments
Part | Type | Description |
---|---|---|
EquationCode | String |
The code of the equation to be executed |
inputJSON | String |
The JSON payload to access with Optiva to process API
Example:
|
Example
When a workflow is started in an action set, this scripting function is executed.
Steps
- Create a new Action “CALCULATE_VALUE” and specify this script:
Option Strict Off imports System imports System.Diagnostics Class EquationScript Inherits FcProcFuncSetEQ Function evaluate() As Long Dim rc As Integer = 1 Dim jsonObj As Dictionary(Of String, Object) = New Dictionary(Of String, Object)() jsonObj = Deserialize(Of Dictionary(Of String, Object))(Context.EquationParams) Dim parameter = jsonObj("PARAM_NAME") '''Provide implementation for the equation Dim calculatedValue As String = "20" Context.ReturnValue = "Symbol:" & Context.ObjectSymbol & " Key:"& Context.ObjectKey & " Parameter: " & Parameter & " Value: " & calculatedValue Return rc End Function End Class
- Navigate to
- Create a new Action"CALCULATE VALUE" and specift this script:
Option Strict Off Imports System Imports System.Diagnostics Class ActionScript Inherits FcProcFuncSetEventWF Function wf_start() As Long Dim formattedJson As String = String.Format("{{""Symbol"": ""{0}"", ""ObjectKey"": ""{1}"", ""EquationParams"": {{""PARAM_NAME"": ""COST""}}}}", _OBJECTSYMBOL, _OBJECTKEY) Dim value As string value = EvaluateEquation("CALCULATE_VALUE",formattedJson) MessageList(_OBJECTSYMBOL) MessageList(_OBJECTKEY) MessageList(formattedJson) MessageList(value) End Function End Class
- Navigate to
- Create a new Action Set
- Assign the Action “CALCULATE_VALUE” in the Steps grid
- Assign a User Code and the description in the row
- Navigate to Security tab and assign the desired User/Role/Group
- Assign “ITEM” as the Target Data symbol and save the Action Set
- Navigate to , open any object
- Click on and launch the “APIGET_ITEMDESCR” workflow