DataFlux Data Management Studio 2.6: User Guide

Expression Node

You can add an Expression node to a data job to create your own expressions using the Expression Engine Language (EEL) scripting language. (Refer to the DataFlux Expression Language Reference Guide for additional information.) Once you have added the node, you can double-click it to open its properties dialog. See also Usage Notes for this node.

The properties dialog includes the following elements:

Name - Specifies a name for the node.

Notes - Enables you to open the Notes dialog. You use the dialog to enter optional details or any other relevant information for the input.

Expression Tab - Enables you to assign values to variables, use functions to manipulate data, and loop through records. Code in the expression area is processed once for each record in your data set.

Pre-Processing Tab - Enables you to enter expression code that should be executed before executing the main Expression code, such as declaring and initializing variables. Code in the pre-processing expression area is processed before DataFlux Data Management Studio accesses the record set.

Post-Processing Tab - Enables you to enter expression code that should be executed after executing the main expression code, such as assigning final values and controlling output.

Functions - Displays the Functions dialog, which lists all available expression functions. When you select a function, a description of the function is displayed in the box at the bottom of the dialog.

Fields - Displays the Fields dialog. You can double-click the fields to copy them directly into the code area.

Save - Enables you to save the code in all three expression editing areas to a special expression file.

Load - Enables you insert code from an existing expression file.

Grouping - Enables you to set up your incoming data to group by a field, such as state. Note that if you plan to group your data, you must first sort your data.

Generate rows when no parent is specified - When selected, enables you to test an expression without using a table to create rows. Output is displayed on the Preview tab. See Usage Notes.

Pushed status field - Specifies a pushed status field to be created in the output. The field holds the value true when the row results from a pushrow() action, and false otherwise. To indicate that a row is pushed on your expression step, check Pushed status field and enter the name of the field.

Return status field - Specifies a return status field to be created in the output. If a field name is specified here, then the field will be created in the output. The field will be set to true or false according to what the expression returned. Normally, returning false from an expression results in no row appearing in the output. If a field name is specified here, then the value will be set to false for the field and the row will be returned.

You can access the following advanced properties by right-clicking the Expression node:

Usage Notes

seteof() is Required by Data Jobs

When an Expression node is used in a data job, then a seteof() marker is required when there is logic in the expression. Otherwise the data job will not terminate properly. Here is some example code that could be used in a data job.

File f f.open
("%%TerminateTargets%%1_express_genCked.txt", "w")
integer i
integer y
integer x
y=0
x=99
for i = y to x step 1
begin f.writeline("Terminate node did not terminate this job yet")
end
seteof()
f.close()

When an Expression node is used in a process job, then a seteof() marker is not required. If you use this marker in an Expression node within a process job, the job produces an error.

Option: Generate rows when no parent is specified

If you use the Expression node without any input nodes, and you set the option Generate rows when no parent is specified, then the node will loop indefinitely at run-time unless you add logic that stops processing. Note that the indefinite looping does not occur at preview time because there is a global option to specify the maximum number of rows to preview. You can stop processing by using the seteof() function on Expression tab of the node. Here is some sample code that could be used:

// On the Pre-Processing Expression tab

integer count

count=0

 

// On the Expression tab
count=count+1
if count>250 then seteof()

 

Using the ADD_LAST_VAL_FIELDS property in an Expression node

In an Expression node in a data job you can set the ADD_LAST_VAL_FIELDS advanced property to true. Then there will be a new field created for every field in your flow, the new field will have __last appended to its name. That field will contain the value from the previous record that flowed into the node. For example, you could use the following statement to compare the value in the current record with the value in the previous record in a field named revenue:

if revenue > revenue__last then msg="revenue has increased"

Documentation Feedback: yourturn@sas.com
Note: Always include the Doc ID when providing documentation feedback.

Doc ID: dfU_PFUtil_Exp.html