Variables and fields are the dynamic text blocks for reports and contain the dynamic part of the data. Variables usually change once per page or report – an example is the header data of an invoice with invoice number and addressee. Fields on the other hand usually change for every record; a typical example would be the item data of an invoice.
Within the Designer variables are always offered outside of the report container (the "table area”), fields only inside of it, and can only be used there. The separation serves mainly to help the end user. If he were to place a field in the "outside area”, the result would -- depending on the print order -- either be the content of the first or the last record.
Both identifier types (fields and variables) can be ordered hierarchically and are displayed in a folder structure in the Designer. The database table names are automatically added by the databinding so that all data from the "OrderData” table are displayed in a folder "OrderData”.
Custom data can also be ordered hierarchically by using a dot as a hierarchy separator (e.g. "AdditionalData.UserName”).
Consider the case of a 1:n linked data structure such as "InvoiceHeader” or "InvoiceItems”. The header data should usually be declared as variables whereas the actual invoice items should be declared as fields. The properties DataMember and AutoMasterMode can be used to achieve this:
At print time a merge print is automatically generated, if e.g. an invoice form has been designed, a single invoice with its own page numbering, aggregation, etc. is created for each record from the invoice head table.
Effect of the option AutoMasterMode. Left: “AsVariables”, right: “AsFields”.
Variables and fields are passed in typed form, i.e. depending on the content of the database as text, number, etc. The databinding usually cares for that automatically, an explicit passing/assignment of the type is only necessary when custom data is passed additionally (see also Pass Additional Contents). The correct data type is usually also preselected (e.g. when passing DateTime objects).
The following table shows the most important data types:
Data type | Usage |
LlFieldType.Text | Text. |
LlFieldType.RTF | RTF formatted text. This field type can be used in a RTF field or RTF object in the Designer. |
LlFieldType.Numeric LlFieldType.Numeric_Integer |
Integer. The databinding automatically differs between floating point numbers and integer values. |
LlFieldType.Boolean | Logical values. |
LlFieldType.Date | Date and time values (DateTime). |
LlFieldType.Drawing | Drawing. Generally the file name is passed. Directly passing a memory handle is possible for Bitmaps and EMF files. Databinding automatically checks the content of Byte fields and declares them as drawing if a suitable format is found. |
LlFieldType.Barcode | Barcode. Barcodes are most easily passed as instances of the LlBarcode class directly in the Add methods of the Variables and fields property. |
LlFieldType.HTML | HTML. The content of the variable is a valid HTML stream, a file name or an URL. |