@ThisName (Formula Language)
Returns the name of the current field.
Note: This @function is new with Release 6.
Syntax
@ThisName
Return value
name
Text. The name of the current field.
Usage
This @function returns null outside a field formula.
Note: A
hide formula is not a field formula, even though it can be set from
the field properties dialog. The hide formula applies to the paragraph
containing the field. Since a paragraph can contain several fields,
there is no "current field" in this context.
This @function is useful in writing portable code. Use @ThisName to construct references to other fields (for example, in @GetField) that have similar names.
Examples
- Assume a form has fields named Total_1, Quantity_1, Cost_1, Total_2,
Quantity_2, Cost_2, and so on. The Total fields are computed using
the following formula for the value. The same formula can be used
in every Total field.
Suffix := @Right(@ThisName; "_"); QuantityFld := "Quantity_" + Suffix; CostFld := "Cost_" + Suffix; @GetField(QuantityFld) * @GetField(CostFld)
- This formula makes it easier for a designer to check code on a
form that may have several debugging @Prompt functions in several
different fields because it identifies which field value is being
displayed:
result := @Round(2.66); @Prompt([Ok];@ThisName;@Text(result)); result + 2
This example returns 3 in the "roundNumber" dialog box and 5 in the roundNumber field when the form displays.