This article shows how to use parameters and results from a preceding action, in a process.
In our example, we extract data from a table to a file, and after we want to write the number of lines on the first line of the file.
Process overview
SqlFileExport:ExportData expression :
select cus_id, tit_code, cus_name, cus_forname, cus_company
from %x{$T_CUSTOMER/tech:physicalPath()}x%
WriteTxtFile expression :
LINECOUNT:${../SQLFileExport:ExportData/SQL_NB_ROWS}$
Comments
The first action simply extract data from the T_CUSTOMER table to a file. The file path (SQL_EXP_FILENAME) is built with both process parameters "filedir" and "filename".
When executed, this action sets the variable SQL_NB_ROWS to the number of lines that were found.
The second action "WriteTxtFile" writes to the same file as action 1 : the TXT_WRITE_FILENAME refers to the first action parameter : ${../SQLFileExport:ExportData/SQL_EXP_FILENAME}$
The expression that will be written to the file refers to the SQL_NB_ROWS from the first action.
Note the parameter "TWT_WRITE_APPEND=before", for writing the line at the beginning of the file.
Here is a sample file generated :
LINECOUNT:4
1;M. ;DUPONT ;Alain;
2;M. ;MARTIN ;Marc;Transports MARTIN & fils
3;M. ;BOUVIER ;Alain;
4;M. ;DUBOIS ;Paul;