Param
You can use the Param function in Optiva equations to return the value of an objects parameter using the parameters unit of measure.
Note: For concentrations or percentages, the function returns the concentration or percentage value, not the actual amount (mass) in the formula.
When to use
You can use this function to:
- Calculate values based on parameter concentrations or percentages rather than actual amounts.
- Retrieve parameter values at the formula level (total concentration across all ingredients).
// Returns: "16.666" (concentration in MG/100GM) string concentration = Param("SODIUM"); Use when: You need the parameterss concentration/percentage value for the formula
When not to use
You cannot use this function when:
- You need actual amounts (mass). Use
TparamorTparamIteminstead. - With equation-derived parameters. Use
ValParaminstead.
Syntax
string Param(string paramName);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| paramName | string | Yes | The name of the parameter to retrieve |
Return Value
- The application returns the parameter value as a string in its unit of measure.
- The
Paramfunction returns a string unless you convert the value to a numeric data type before performing numeric operations. - For concentrations or percentages, returns the concentration or percentage value, not the actual amount (mass) of the parameter in the formula.
- For alternate unit of measure conversions, use
ObjPropertyto obtain parameter values. Do not useParamorParamItem. - Examples:
- Parameter value = 50, UOM = % → Returns "50"
- Parameter value = 16.666, UOM = MG/100GM → Returns "16.666"
Prerequisites
The function always returns a string. Convert the value for numeric operations.
Examples
- Example 1
- Retrieve the parameter value.
- Description
-
- The equation returns the value of the parameter CALCIUM.
- The value is divided by two.
- The parameter is defined initially by an equation at the item level.
- Then, the parameter is rolled up.
- Assign the parameter to the lab as a rollup.
- If the CALCIUM parameter is overridden at the formula level, then the
paramfunction uses the overridden value.