Tparam
You can use this function for Optiva Equations.
Purpose
Returns the net contribution of a formula’s parameter. This value is based on the percentage or concentration of the total parameter and the formula’s mass.
The
param
functions return a string unless you convert
them to a numeric data type before performing numeric operations, such as
addition. Otherwise, you get a concatenated string when you add several values.
Syntax
Dim variable As String = tparam(<parameter name> or <quantity type>)
Arguments
Part | Description |
---|---|
parameter name
|
The name of the formula parameter. |
quantity type
|
Mass or Volume quantity. Double. The
values are expressed without units of measure.
|
Description
This function takes the concentration (MG/100GM)
or percentage (WT%)
of
parameters in the formula. Then, it returns the actual total mass of the parameter in
the formula.
The TParam
function returns a different
value. This value is based upon the line type of the technical parameter in the lab for
the tp whose value is being requested. When TParam
is
used to retrieve the value of a rollup parameter, the function returns the total value
for the rollup parameter. The value is calculated from the values of the same parameter
for the items in the formula.
This is regardless of the actual value that appears for the requested technical parameter on the formula itself. That value may have been manually overridden, or otherwise assigned through another equation.
Use the Param
function to return the
current (i.e. original or overwritten) concentration or percentage value for the
formula’s parameter. This value is in the parameter’s unit of measure. Suppose the total
(extended) contribution of the parameter for all items is 16.666MG/100GM. Then Param
returns 16.666.
Use the ParamItem
function to return
the concentration or percentage amount for an item’s parameter in a formula. This value
is in the parameter’s unit of measure. Suppose the concentration of the parameter for
one item is 10MG/100GM and the other item is 20MG/100GM. Then ParamItem
returns 10 and 20 respectively.
Use the TparamItem
function to return
the net contribution of an item’s parameter (i.e., the actual value). This value is
based on the percentage or concentration of the parameter and the formula’s mass. What
if the parameter value for one item is 3.33MG/100GM of the formula and there is 3KG
(3000GM) of the item? Then the tparamitem value is 99.9. The calculation is 3.33MG/100GM X
3000GM\100GM = 99.9
.
Examples
This example returns the total amount of sodium per serving. The
SODIUM parameter has a unit of measure of
MG/100GM
. The Tparam
for SODIUM
has a unit of measure of
MG and the SERVING_COUNT
has a unit of measure of
servings.
Dim count As String = param("SERVING_COUNT")
Dim sValue As String = tparam("SODIUM") / count
MessageList("Sodium per serving = ",sValue," mg/serving")
In the next example, the local variable
sBp
is assigned the value of the parameter that is assigned to this equation. The
parameter is type numeric min where the value represents the lowest value of all items
(i.e., parameter type = Numeric Min).
The
If/Then/Else
statement instructs the system to show
alert messages if the boiling point is too low or if it is acceptable. You can
also include return commands inside the conditional statements to alter the
value of the parameter.
Dim sBp As String = tparam("")
if (sBp < 50) then
MessageList("Ingredient boiling point too low.")
else
MessageList("Boiling point okay.")
end if
In this example, the local variable
sLoc
is assigned the value of the parameter SELLINGLOC
. This is an enumerated list parameter. If
sLloc
is EUROPE, then the parameter that is
assigned to this equation is assigned the number 4. Otherwise, the parameter is assigned
the number 10. This can be used to create a constant that varies depending upon another
parameter.
Dim sLoc As String = tparam("SELLINGLOC")
if (sLoc = "EUROPE") then
Dim sValue As String = 4
else
sValue = 10
end if