Command WR INSERT EXPRESSION

4D Write

WR INSERT EXPRESSION

version 6.7 (Modified)


WR INSERT EXPRESSION (area; expression{; numFormat{; dateFormat{; timeFormat}}})

ParameterTypeDescription
areaLongint4D Write area
expressionStringExpression to insert
numFormatStringNumeric format
dateFormatIntegerNumber of the date format
timeFormatIntegerNumber of the time format

Description

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:

Date formatConstant (value)
<No date>wr no date format (0)
1/6/00System date short (1)
Thu, Jan 6 2000System date abbreviated (2)
Thursday, January 6 2000System date long (3)
01/06/2000Internal date short special (4)
January 6, 2000Internal date long (5)
Jan 6, 2000Internal date abbreviated (6)
01/06/2000Internal date short (7)

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:

Time formatConstant (value)
<No time>wr no time format (0)
HH:MM:SSHH MM SS (1)
HH:MMHH MM (2)
HH hours MM minutes SS secondsHour Min Sec (3)
HH hours MM minutesHour Min (4)
HH:MM AM PMHH MM AM PM (5)

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")

See Also

WR GET REFERENCE, WR INSERT FIELD.