4D v13

WR INSERT EXPRESSION

Home

 
4D Write v13
WR INSERT EXPRESSION

WR INSERT EXPRESSION 


 

WR INSERT EXPRESSION ( area ; expression {; numFormat {; dateFormat {; timeFormat {; destination {; size}}}}} ) 
Parameter Type   Description
area  Longint in 4D Write area
expression  String in Expression to insert
numFormat  String in Numeric format
dateFormat  Integer in Number of the date format
timeFormat  Integer in Number of the time format
destination  Longint in Place where picture is to be placed
size  Longint in 0=Size fixed, 1=Size adjusted

The WR INSERT EXPRESSION command inserts a reference to expression into area, replacing any currently selected text.

expression must be a valid 4D expression that returns a value. expression can be a 4D variable, function, or statement that returns a value; an external function or a user-defined function (project method); or a picture variable. If expression is a variable, you should pass its name between double quotes ("").
If expression returns a value that includes carriage returns and tabs, 4D Write formats the text according to the ruler of the paragraph in which expression resides.

The numFormat optional parameter indicates the format of numeric expressions (i.e. Real, Integer, or Longint). It can contain any numeric display format, whether it exists or not (for example “###,##”). Put an empty string when this parameter is not appropriate or omit it if the following two parameters have been omitted.

The dateFormat optional parameter indicates the format of Date type expressions. It must contain a number that indicates an existing date format. Put 0 when this parameter is not appropriate or omit it if the following parameter has been omitted.
Otherwise, use the following 4D constants, found in the "Date Display Formats" theme of 4D and the WR Parameters theme of 4D Write:

Constant Type Value Comment
System date short Longint 1 12/29/2006
System date abbreviated Longint 2 Sun, Dec 29, 2006
System date long Longint 3 Sunday, December 29, 2006
Internal date short special Longint 4 12/29/06 (but 12/29/1896 or 12/29/2096)
Internal date long Longint 5 December 29, 2006
Internal date abbreviated Longint 6 Dec 29, 2006
Internal date short Longint 7 12/29/2006

Constant Type Value Comment
wr no date format Longint 0 No date format

The timeFormat optional parameter indicates the format of Time type expressions. It must contain a number indicating an existing time format. Put 0 when this parameter is not appropriate or omit it.
Otherwise, use the following 4D constants, found in the "Time Display Formats" theme of 4D and the WR Parameters theme of 4D Write::

Constant Type Value Comment
HH MM SS Longint 1 01:02:03
HH MM Longint 2 01:02
Hour Min Sec Longint 3 1  hour 2 minutes 3 seconds
Hour Min Longint 4 1 hour 2 minutes
HH MM AM PM Longint 5 1:02 AM

Constant Type Value Comment
wr no time format Longint 0 No time format

When you insert a picture expression, the optional destination parameter indicates where the picture must be inserted into the document. You can choose any value more than 0 or one of the following constants, found in the "WR Parameters" theme:

Constant Type Value Comment
wr on left hand pages Longint -12 The picture will be inserted into the page and will be displayed on left-hand pages onlyif the even- and odd-numbered headers are different.
wr on right hand pages Longint -11 The picture will be inserted into the page and will be displayed on right-hand pages if the even- and odd-numbered headers are different, and otherwise on every page.
wr on current page Longint -4 The picture will be inserted on the page and visible on the current page (that containing the insertion point or the current selection).
wr into the text flow Longint 0 The picture will be inserted into the text flow. In this case the other parameters will not be used and the picture will either be inserted at the location of the insertion point or will replace the current selection.

Any value >0The picture is visible on the page number passed in destination. The value must take the start number into account.

When adding a picture expression, the optional size parameter sets whether the display rectangle will be kept or adjusted:

  • If you pass 1 in size, when the expression is calculated, the display rectangle is adjusted to the new picture size.
  • If you pass 0  in size, when the expression is calculated, the display rectangle is kept as is, regardless of the new picture size.

Example  

The following two-part example shows a reference to a 4D project method inserted into a 4D Write area. The project method finds a customer’s related invoices and concatenates the invoice numbers and amounts.

  `Project method SHOW INVOICES
 $Tab:=Char(Tab Key)
 $CR:=Char(Return Key)
 RELATE MANY([Customers])
 FIRST RECORD([Invoices])
 $0:=""
 For($i;1;Records in selection([Invoices]))
    $0:=$0+[Invoices]Number+$Tab+String([Invoices]Amount;"$###,##0.00")+$CR
    NEXT RECORD([Invoices])
 End for

The second part of this example shows the insertion of the SHOW INVOICES project method into area. When 4D Write displays or prints area, each invoice will appear in a separate line.

 WR INSERT EXPRESSION(area;"SHOW INVOICES")

 
PROPERTIES 

Product: 4D
Theme: WR Database Objects
Number: 89226

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Write 6.7
Modified: 4D Write v11.6

 
SEE ALSO 

WR GET REFERENCE
WR INSERT FIELD