This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com

Home

 
4D v20.6
PROCESS 4D TAGS

PROCESS 4D TAGS 


 

PROCESS 4D TAGS ( inputTemplate ; outputResult {; param}{; param2 ; ... ; paramN} ) 
Parameter Type   Description
inputTemplate  Text in Data containing tags to process
outputResult  Text in Result from template execution
param  Expression in Parameter(s) passed to template being executed

The PROCESS 4D TAGS command causes the processing of 4D transformation tags contained in the inputTemplate parameter while (optionally) inserting value(s) using the param parameters and returns the result in outputResult. For a complete description of these tags, refer to the 4D Transformation Tags section.

This command lets you execute a "template" type text containing tags and references to 4D expressions and/or variables, and to produce a result depending on the execution context and/or the values passed as parameters.
For example, you can use this command to generate and save HTML pages based on semi-dynamic pages containing 4D transformation tags (without it being necessary for 4D's Web server to be started). You can use it to send e-mail messages in HTML format that contain processing of and/or references to data contained in the database via the 4D Internet Commands. It is possible to process any type of data based on text, such as XML, SVG or multi-style text.

Pass the data containing the tags to be processed in the inputTemplate parameter. This parameter can be a field or variable of the Text type. 

All the transformation tags of 4D are supported (4DTEXT, 4DHTML, 4DSCRIPT, 4DLOOP, 4DEVAL, etc.).

Note: When using the 4DINCLUDE tag outside the framework of the Web server (Web process):

  • with 4D in local mode or 4D Server, the default folder is the folder containing the database structure file,
  • with 4D in remote mode, the default folder is the folder containing the 4D application.

The PROCESS 4D TAGS command supports an indefinite number of param parameters that can be inserted into the executed code. As with project methods, these parameters can contain scalar values of varied types (text, date, time, longint, real, boolean), as well as pointers, objects and collections. You can also use arrays, by means of array pointers. Inside the code processed by the 4D tags, these parameters can be accessed by means of standard arguments ($1, $2, etc.), just like in 4D methods (see example).
A dedicated set of local variables is defined in the execution context of the PROCESS 4D TAGS command. These variables can be written or read during processing.

After command execution, the outputResult parameter receives the execution result of the inputTemplate parameter, along with the result of the processing of any 4D tags that it contains, when applicable. If inputTemplate does not contain any 4D tags or produces an empty string, the contents of outputResult is identical to that of inputTemplate.

The outputResult parameter may be a field or a variable of the Text type.

Note: This command never calls the On Web Authentication database method.

This example loads a 'template' type document, processes the tags it contains and then stores it:

 C_TEXT($inputText_t)
 C_TEXT($outputText_t)
 
 $inputText_t:=Document to text(File("/PACKAGE/mytemplate.txt").platformPath)
 PROCESS 4D TAGS($inputText_t;$outputText_t)
 TEXT TO DOCUMENT(File("/PACKAGE/myfile.txt").platformPath;$outputText_t)

This example generates a text using data of the arrays:

 ARRAY TEXT($array;2)
 $array{1}:="hello"
 $array{2}:="world"
 $input:="<!--#4DEVAL $1-->"
 $input:=$input+"<!--#4DLOOP $2-->"
 $input:=$input+"<!--#4DEVAL $2->{$2->}--> "
 $input:=$input+"<!--#4DENDLOOP-->"
 PROCESS 4D TAGS($input;$output;"elements = ";->$array)
  // $output = "elements = hello world"



See also 

4D Transformation Tags

 
PROPERTIES 

Product: 4D
Theme: Tools
Number: 816

This command can be run in preemptive processesDifferent in remote mode

 
PAGE CONTENTS 
 
HISTORY 

Created: 4D 2004
Modified: 4D v11 SQL
Modified: 4D v12
Renamed: 4D v13 (PROCESS HTML TAGS)
Modified: 4D v14 R4
Modified: 4D v16 R4

 
ARTICLE USAGE

4D Language Reference ( 4D v20)
4D Language Reference ( 4D v20.1)
4D Language Reference ( 4D v20.2)
4D Language Reference ( 4D v20.3)
4D Language Reference ( 4D v20.4)
4D Language Reference ( 4D v20.5)
4D Language Reference ( 4D v20.6)