4D Chart v13

CT INSERT EXPRESSION

Home

 
4D Chart v13
CT INSERT EXPRESSION

CT INSERT EXPRESSION 


 

CT INSERT EXPRESSION ( area ; scope ; first ; last ; expression ; format ) 
Parameter Type   Description
area  Longint in 4D Chart area
scope  Longint in -1 = First object 0 = First object in selection >0 = Object ID
first  Integer in Position of first character minus 1
last  Integer in Position of last character
expression  String in Expression
format  String in Format of expression

The CT INSERT EXPRESSION command inserts a reference to expression into the text object in the area described by scope.

  • If scope equals -1, CT INSERT EXPRESSION inserts the reference into the first object of the document.
  • If scope equals 0, CT INSERT EXPRESSION inserts the reference into the first selected object.
  • If scope is greater than 0, it must be equal to a specific text object’s ID and the reference is inserted within that text object. If the object does not exist, CT INSERT EXPRESSION does nothing.

If the object described by scope is not a text object, CT INSERT EXPRESSION does nothing.

first and last determine where the reference is inserted. first is one less than the first character position to be replaced and last is the last character position to be replaced. If first equals last, no characters are replaced and the reference is inserted between first and first +1. If last is greater than the number of characters in the text object, CT INSERT EXPRESSION replaces characters from first to the end.

expression is the text equivalent of any valid 4D expression that returns a value. expression can be a reference to any of the following: a field, a variable, a 4D function, a user-defined function (project method), a plug-in function, or a statement.

The following table gives examples for each expression type:

ExampleType
[Drawings]ObjectField
vCriteriaVariable
Current Date4D function
GetNumUser defined function (project method)
CT Count4D Chart function
3 * "Hello"Statement

The optional format parameter is the display format for the reference. This parameter is equivalent to choosing a format from the Format dialog box. Formats are referred to either by their number or their name. Formats are numbered in the order in which they appear in the list of the Format dialog box.

If format is a one or two digit string, then the format applied to field is from the list. If format is not a one or two digit string, then it is compared to the text values of each format in the list. If it matches one of the values in the list, that format is applied. This means that you can refer to the first date format as either “19” or “Short”.

If format is not in the list of formats, it is interpreted as a custom numeric format. If format is inappropriate for the resulting value of the reference, it is ignored. For instance, if you use a date format on a number, the number appears unformatted.

Example  

This example creates a new text object, fills it with a reference to the 4D function Current date and formats it using the Long date format.

 $ID :=CT Draw text(Area;0.5;0.5;3.5;1;"Today's date is: ")
 CT INSERT EXPRESSION(Area;$ID;32000;32000;"Current date";"Long")

 
PROPERTIES 

Product: 4D Chart
Theme: CT Objects
Number: 14602

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D Chart 1

 
SEE ALSO 

CT INSERT FIELD