SetParam
You can use the SetParam function to assign a calculated or specific value to a parameter. This function is used in equations to set parameter values based on calculations, business logic, or the values of other parameters.
When to use
You can use this function when setting values for one or more parameter codes in an equation that differ from the parameter associated with the equation.
When not to use
You cannot use this function outside of equation scripts.
Syntax
int SetParam(string paramName, string paramValue);
int SetParam(string paramName, int paramValue);
int SetParam(string paramName, double paramValue);
int SetParam(string paramName, string paramValue, int forceValue);
Parameter
| Parameter | Type | Required | Description |
|---|---|---|---|
| paramName | string | Yes | Name of the parameter to set. |
| paramValue | string/int/double | Yes | The value to assign to the parameter. |
| forceValue | int | Optional | Applies to rollup parameters only. Ignored by non-rollup parameters. Possible values:
|
Return Value
The application returns an integer status code, typically 0, if the operation is successfully.
Prerequisites
- The function is designed for use in Optiva equations.
- No additional permissions are required beyond equation execution.
Examples
- Example 1
-
Read value of a parameter using
Tparamand assign it to another parameter usingSetParam.using System; using System.Diagnostics; public class EquationScript : FcProcFuncSetEq { public long evaluate() { long _returnvalue; object setValue; string _eqValue; _eqValue = TParam("TotalMass"); setValue = SetParam("UN_AQ", _eqValue, 0); MessageList("Total Mass = ", _eqValue, "KG"); Context.ReturnValue = _eqValue; return 1; } }