4D v13Inserting dynamic references |
|||||||||||||||||||||
|
4D Chart v13
Inserting dynamic references
Inserting dynamic references
You can add dynamic references to field values or to 4D expressions by inserting expressions into text objects. Using field references and 4D expressions, you can create 4D Chart documents that incorporate information from your database. For example, you can use field information from the records to make graph titles. You can use 4D expressions to perform tasks such as computing numeric values or concatenating text information. You can display the information from 4D as either values or references. A value is the actual information stored in a field or calculated from an expression. A reference is the name of the field or the text of the expression. When expressions and fields are displayed as references, they are surrounded by the following symbols: « and ». For example, a reference to the First Name field in the [Stationery Order] table would appear as:
4D Chart inserts these symbols when a field is inserted into a text object. When you insert any other type of reference, such as a 4D function or variable, you must indicate that it is a reference. 4D Chart will then add the « and » symbols to differentiate the reference from normal text. For more information on referencing expressions, see the Inserting 4D expressions section below. When references are displayed as values, the « and » symbols do not appear; for example, a field value for First Name might be:
The field value appears as standard text. Field references and 4D expressions always refer to the current record and are updated whenever the current record changes. If there is no current record, no value is displayed. By inserting a field reference in a 4D Chart document, you add dynamic information to the document. As the field is updated, so is the value in 4D Chart. You can use fields from any table in the database. The field reference or value appears in a text object, except for references to picture fields. The text object containing a reference acts as any other text object; you can change its attributes, move it, and so on. When you insert a field reference in a 4D Chart plug-in window, the value that is displayed when you choose Show Values from the Database menu is the field’s value for the current record. If no record is currently loaded there will be no value displayed in the 4D Chart plug-in window. In order to show the value stored in a field for a particular record, make sure that the record is loaded — by displaying the record in an input form, for instance. If the current record changes, the value displayed in the field changes. When you insert a field reference in a 4D Chart area on an input form, the value that is displayed when you choose Show Values from the Database menu is the field’s value for the current record. To paste a field reference into a 4D Chart document, you have two tools available:
To paste a field reference into a 4D Chart document using the dialog box:
To insert a field into a 4D Chart document using the pop-up menu:
You cannot paste references to Picture fields when you select a field from a drop-down list. When you are working in a form, you can choose fields from a drop-down list that displays the fields in the current table, or from a drop-down list of fields for all tables in the database. When you use 4D Chart in a plug-in window, the drop-down list always contains both tables and fields. You can insert any valid 4D expression into a document. The expression can be a 4D variable, a 4D function, a plug-in function, or a method that returns a value. With expressions you can use the power of 4D’s language within 4D Chart documents. You can perform calculations, concatenate information from several fields, and so on. The following table contains some examples of expressions:
An expression is evaluated only when you perform one of the following actions:
To insert a 4D expression into a 4D Chart document:
When you display values, you show the actual values stored in referenced fields and the values calculated by referenced 4D expressions. For example, if the reference is «Current date», today’s date is displayed.
You can change the value in a dynamic reference into static text that will not be updated when the value changes. For instance, you can use the 4D expression «Current date» to display the date you created a graph, and then change that date to a static text object. No matter what the current date is, the text object will always display the creation date of the graph. Changing a value to text is called unreferencing the value, because the value no longer has a dynamic reference to the database. Once you have unreferenced a value, you cannot change it back to a reference. To change a value in a field reference or expression to text:
You can change a reference into text by unreferencing it. When you change a reference to text, you change the words of the reference, not the value to which the reference refers. For instance, if you change the reference «Current date» to text, the text object displays the following:
When you choose Show Values from the Database menu, this text does not change, and the current date is not displayed, because the text no longer refers to a 4D expression. You may want to edit a reference or permanently change it to standard text. If you want to edit a reference, you must unreference it, edit it, and then reference it again. To unreference a field reference or expression:
You can use a display format for the value of any numeric, date, or time field, or expression in 4D Chart. For instance, you can use a display format to display dollar amounts using the dollar sign ($), commas, and decimals. The following table shows some examples of display formats:
To format a reference:
|
PROPERTIES
Product: 4D |
|||||||||||||||||||