The labelizepattern( function formats a text value using a label and a pattern.
Parameters
This function has three parameters:label – is a label identifying the value.
value – is the value to be formatted.
pattern – is the pattern that will be used. If this parameter is omitted, a default pattern will be used (see below).
Description
This function formats a text value using a label and a pattern. It is used internally to create functions like labelizeformula( and labelizeinfo(, but can also be used independently. In its simplest form, this function takes a label and a value, and combines them using a default pattern.
labelizepattern("Sum",2+2) ☞ Sum: 4
labelizepattern("Database",info("databasename")) ☞ Database: Contacts
labelizepattern("NAME",upper(Name) ☞ NAME: BOB WILSON
If the value contains more than one line, a different default pattern is used. Suppose you have a field named Full Address that contains an entire address. In that situation, the formula:
labelizepattern("OPEN DATABASES",info("files"))
will return a result like this:
=== OPEN DATABASES ============
Contacts
Orders
Products
=== END OF OPEN DATABASES ============
If the standard pattern doesn’t meet your needs, you can add a third parameter to supply your own custom pattern. This pattern must contain «label»
where you want the label to appear, and «value»
where you want the value to appear. Here’s an example where using a custom pattern reveals that the city name has an extra space on the end.
labelizepattern("City",upper(City),"«label» >>>«value»<<<") ☞ City >>>FRESNO <<<
This is such a common situation that there is a special shortcut pattern set up for this situation, ><
.
labelizepattern("City",upper(City),"><") ☞ City -->FRESNO <--
Note: The default patterns built into the labelizepattern( function are:
"«label»: «value»"
and
"=== «label» ============"+cr()+"«value»"+cr()+"=== END OF «label» ============"
for multi-line values.
See Also
History
Version | Status | Notes |
10.2 | New | New in this version. |