ParamItem
You can use the ParamItem function in Optiva equations to return the concentration or percentage value of an items parameter for a formula, using the parameters unit of measure.
When to use
You can use this function to:
- Retrieve parameter values for specific ingredients in a formula.
- Analyze ingredient contributions for specific parameters, such as sodium or calcium.
When not to use
You cannot use this function when:
- You need actual amounts (mass). Use
TparamorTparamIteminstead. -
You need formula-level concentration. Use
ParamorValParaminstead.
Syntax
string ParamItem(string paramName, string itemCode);
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| paramName | string | Yes | The name of the parameter to retrieve. |
| itemCode | string | Yes | The item code OR line number. For example, "ITEM001" or "#02". |
Return Value
- The application returns the parameter value as a string in its unit of measure.
- The parameter functions return a string unless you convert the value to a numeric data type before performing numeric operations.
- The value is an attribute of the item and is not dependent on how the item is used in the formula.
- For alternate unit of measure conversions, use
ObjPropertyto obtain parameter values. Do not useParamorParamItem. - Examples: When the parameter is a concentration or percentage, the concentration or percentage value is returned,not the actual amount of the parameter.
- Item 1: SODIUM = 10 MG/100GM → ParamItem returns "10"
- Item 2: SODIUM = 20 MG/100GM → ParamItem returns "20"
Prerequisites
Always returns a string. Convert the value to a numeric data type for numeric operations.Param VS ParamItem
| Feature | Param | ParamItem |
|---|---|---|
| Level | Formula level. | Item level. |
| Syntax |
|
ParamItem("SODIUM", "ITEM001") |
| Returns | Total formula concentration. | Specific items concentration. |
| Use Case | Formula-level value. | Individual ingredient value. |
| Example Result | "30" (total) | "10" (one item) |
Examples
- Example 1
- Get parameter from Line ID.
- Description
- The sValue variable assigns the amount of calcium from an item. The item is on line two of the Item Lines tab.
- Example 2
-
Get parameter from specific item code.
string value = ParamItem("CALCIUM", "SALT001");
- Description
- The sValue variable assigns the amount of calcium from an item SALT001.
Note
- Need item-specific value? → Use
ParamItem. - Need formula total? → Use
Param. - Need actual amount from item? → Use
TparamItem. - Line number format → "#01", "#02", "#10" (two digits).
- Item code format → "ITEM001", "SALT", "WATER" (actual code).