TParamItem

You can use the TParamItem function to return the net contribution (actual total mass) of a parameter for a specific item in a formula.

The value is calculated from the parameter concentration (MG/100GM) or percentage (WT%) and the items contribution to the formula.

When to use

You can use this function to:

  • Calculate the actual contribution of a parameter from a specific item in a formula.
  • Determine how much a specific ingredient contributes to a parameter value.

When not to use

You cannot use this function to:

  • For total formula amounts. Use TParam instead.
  • Retrieve concentration or percentage values. Use ParamItem instead.

Syntax

string TParamItem(string paramName, string itemCode);

Parameters

Parameter Type Required Description
paramName string Yes The name of the parameter.
itemCode string Yes The code of the item for which the parameter contribution is returned.

Return Value

The application returns the actual total mass or amount of the parameter contributed by the specified item as a string if the operation is successful. The returned value must be converted to a numeric data type before performing calculations.

How TparamItem Works

Calculation
Calculates the actual amount from the items parameter concentration and the items quantity
Example Calculation
  • Parameter value: 3.33 MG/100GM of the formula
  • Item quantity: 3 KG (3000 GM)
  • Calculation: 3.33 MG/100GM × 3000 GM / 100 GM = 99.9 MG
  • TparamItem returns: "99.9"
Scenario
Consider a Formula with 3 items.
Item Parameter Concentration Item Quantity TparamItem Calculation Result
Item 1 3.33 MG/100GM 3000 GM 3.33 × 3000 / 100 99.9 MG
Item 2 10.00 MG/100GM 1500 GM 10.00 × 1500 / 100 150.0 MG
Item 3 16.67 MG/100GM 1500 GM 16.67 × 1500 / 100 250.05 MG
Total (Tparam) - - Sum of above 499.95 MG

Prerequisites

  • TParamItem is used in Optiva equations.
  • The returned value is calculated from the parameter concentration and the items contribution to the formula.
  • ParamItem returns concentration values, whereas TParamItem returns actual amounts.

Examples

Example 1
The equation returns the total value and concentration of sodium for item1.
// Get sodium concentration for Item1
string sValue = paramitem("SODIUM", "Item1");

// Get total sodium value in the formula
string sValue1 = tparam("SODIUM");

// Display concentration value
MessageList("Concentration of sodium for Item1 =", sValue, "MG/100GM");

// Display total value
MessageList("Total value of sodium in the formula from Item1 = ", sValue1, "MG");
See Difference Between Param, ParamItem, Tparam, and TparamItem