To be able to make full use of 4D tags one needs to understand how to pass, process and retrieve complex variables such as arrays and BLOBs with PROCESS 4D TAGS.
When working with PROCESS 4D TAGS and the desired output is a complex variable such as an array, PROCESS 4D TAGS will not return the desired output variable using. The solution is to consider using a parameter to received the desired variable as the receptor for the array or BLOB.
The OutputResult is intended to return the entire inputTemplate after processing. Once imaginative uses of 4D Transitions Tags begin to be integrated into customer databases there will be occasions when the desire will be to processe data into complex variables using PROCESS 4D TAGS. Below are three examples of how to use PROCESS 4D TAGS to process an inputtemplate and use one of the param parameter to receive the result in either an array or BLOB.
Example, 1: Size, populate and transfer an array into param #1, passed as a pointer...
<!--#4DEVAL $TxtArr_P := $1-->
<!--#4DEVAL // Size the array within the template-->
<!--#4DEVAL //-->
<!--#4DEVAL ARRAY TEXT:C222($1->;5)-->
<!--#4DEVAL $TxtArr_P->{1} := "Element #1"-->
<!--#4DEVAL $TxtArr_P->{2} := "Element #2"-->
<!--#4DEVAL $TxtArr_P->{3} := "Element #3"-->
<!--#4DEVAL $TxtArr_P->{4} := "Element #4"-->
<!--#4DEVAL $TxtArr_P->{5} := "Element #5"-->
ARRAY TEXT($Strings_aT;0) $Buf_T:=Document to text(Get 4D folder(HTML Root folder)+"InputTemplate.txt") // InputTemplate and OutputResult must be of the same type // PROCESS 4D TAGS($Buf_T;$Buf_T;->$Strings_aT) |
Example, 2: Size, populate and transfer an array into param #1, passed as a pointer...
<!--#4DEVAL $TxtArr_P := $1-->
<!--#4DEVAL // Use APPEND TO ARRAY to size the array-->
<!--#4DEVAL //-->
<!--#4DEVAL APPEND TO ARRAY:C911 ( $TxtArr_P-> ; "Element #1" )-->
<!--#4DEVAL APPEND TO ARRAY:C911 ( $TxtArr_P-> ; "Element #2" )-->
<!--#4DEVAL APPEND TO ARRAY:C911 ( $TxtArr_P-> ; "Element #3" )-->
<!--#4DEVAL APPEND TO ARRAY:C911 ( $TxtArr_P-> ; "Element #4" )-->
<!--#4DEVAL APPEND TO ARRAY:C911 ( $TxtArr_P-> ; "Element #5" )-->
ARRAY TEXT($Strings_aT;0) $Buf_T:=Document to text(Get 4D folder(HTML Root folder)+"InputTemplate.txt") // InputTemplate and OutputResult must be of the same type // PROCESS 4D TAGS($Buf_T;$Buf_T;->$Strings_aT) |
Example, 3: Size, populate and transfer an array into a BLOB passed as param #1 as a pointer...
<!--#4DEVAL ARRAY TEXT:C222 ( $TxtArr_P; 5 )-->
<!--#4DEVAL $TxtArr_P{1} := "Element #1"-->
<!--#4DEVAL $TxtArr_P{2} := "Element #2"-->
<!--#4DEVAL $TxtArr_P{3} := "Element #3"-->
<!--#4DEVAL $TxtArr_P{4} := "Element #4"-->
<!--#4DEVAL $TxtArr_P{5} := "Element #5"-->
<!--#4DEVAL VARIABLE TO BLOB:C532 ($TxtArr_P; $1->)-->
C_BLOB($BLOBout_X) ARRAY TEXT($Strings_aT;0) $Buf_T:=Document to text(Get 4D folder(HTML Root folder)+"InputTemplate.txt") // InputTemplate and OutputResult must be of the same type // PROCESS 4D TAGS($Buf_T;$Buf_T;->$BLOBout_X) BLOB TO VARIABLE($BLOBout_X;$Strings_aT) |