TParam

You can use the TParam function to return the net contribution (actual total mass) of a formula parameter by calculating it from the concentration (MG/100GM) or percentage (WT%) and the total formula mass.

Note: This function always returns a string value, which must be converted to a numeric data type before performing calculations.

When to use

You can use this function to:

  • Retrieve the actual mass or amount of a parameter in a formula rather than its concentration.
  • Calculate actual nutrient amounts for nutrition labels, such as the milligrams of sodium per serving.
  • Calculate the total contribution of a parameter across the entire formula.

When not to use

You cannot use this function to:

  • Retrieve concentration or percentage values. Use Param instead.
  • Retrieve the contribution of an individual item. Use TParamItem instead.
  • Display percentage values. Use Param for concentration or percentage values.

Syntax

string TParam(string paramName);

Parameters

Parameter Type Required Description
paramName string Yes The name of the formula parameter.

Return Value

The application returns the actual total mass or amount of the parameter as a string if the operation is successful.

Note: The returned value must be converted to a numeric data type before performing calculations.

How Tparam works

Calculation
Takes the concentration (MG/100GM) or percentage (WT%) of parameters in the formula and returns the actual total mass of the parameter in the formula.
Example calculation

If total concentration = 16.666 MG/100GM and formula mass = 3000 GM:

Tparam calculation: 16.666 MG/100GM × 3000 GM / 100 = 499.98 MG

Note: When Tparam is used to retrieve a rollup parameter, it returns the total value calculated from the values of the same parameter for the items in the formula, regardless of any manual override or equation assignment on the formula itself.

Prerequisites

  • TParam is used in Optiva Equations.
  • The returned value is calculated using the parameter concentration and the total formula mass.
  • Param returns concentration values, whereas TParam returns actual amounts.

Examples

Example 1
Calculate Sodium Per Serving.
string count = Param("SERVING_COUNT");
string sValue = (Convert.ToDouble(Tparam("SODIUM")) / Convert.ToDouble(count)).ToString();

MessageList("Sodium per serving = ", sValue, " mg/serving");
See Difference Between Param, ParamItem, Tparam, and TparamItem