ReportWorkshop: new functions
Report Workshop is a reporting add-on. It allows to build rich-text reports in TRichView and ScaleRichView editors.
In the previous update, expressions were introduced. They can be used to insert values in text, calculate conditions of $if command, visualize values.
Expressions may call functions (on text, numeric, logical, date-time arguments).
The syntax of expressions and the list of functions are described here:
https://www.trichview.com/help-report/expressions.htm
In this update, we added several new functions for expressions.
SpellNumber()
SpellNumber() converts the integer value to text in the specified Language.
The function supports: English, Portuguese (European and Portuguese), Russian. More languages will be added on request.
For example, SpellNumber(125,"en","") returns "one hundred and twenty five".'
This function supports the following options:
- grammatical gender (useful in Russian and Portuguese)
- monetary spelling rules (useful in English)
SpellCurrency()
SpellCurrency() converts the monetary value to text in the specified Language.
The function supports the languages: English, Portuguese (European and Portuguese), Russian. More languages will be added on request.
The function supports the currencies: USD, EUR, BRL, RUB. More currencies will be added on request.
This function supports the following options:
- returning a fractional value (cents) as digits
- not including zero fractional value (0 cents) in the result.
UpperFirst()
UpperFirst() converts the first letter of text to upper case.
This function includes special processing for characters that have special title case variant, different from an upper case.
For example, a ligature "lj" is converted to a ligature "Lj", not to "LJ".
This function is especially important with conjunction of SpellNumber and SpellCurrency.
Query()
Query() executes a data query and returns its result as a text string.
This function adds one more way of linking reports to data.
So the following ways to display data are available:
- a data query linked to the whole report (repeating report template for each record)
- a data query linked to table rows or a group of table cells (repeating rows or cells), called "table row generation rules"
- a data query linked to table cell (repeating a cell content)
- Query() function.
Query function accepts the parameters:
- data query string (such as a table name or a SQL SELECT statement)
- format string (defines how each record will be represented in the result)
- delimiter (string between records).
Example: Query("select * from FruitTable", "{FruitName}", ", ") returns a string like "apple, orange, peach".
Values passed to this function arguments can contain expressions as well, so calls of Query() function can be nested to create master-detail reports.