By using Data360 Analyze Script, you can choose which data fields you want to include in the output of a node.
How do I specify which fields to include in the output?
Some of the most common output-related Data360 Analyze Script keywords are listed below:
-
emit* (output all) - output all fields
emit *
-
emit - specify what to output
emit <comma-separated list of fields>e.g. emit 'white','blue'
-
exclude - specify a field that you do not want to include in the output
emit *exclude <field name>e.g. exclude 'white'
-
where - specify a condition to control when to output certain data
emit<list of fields>where<conditional expression>
How do I create a new field in the output?
You can use a Data360 Analyze Script expression to define a new field, in the following format:
<new field name> = <expression>emit <new field name>
or, use the "as" command to indicate where the expression ends and the output field name begins:
emit <expression> as <new field name>
How do I override the data in an existing field?
-
override emit - overrides the data in an existing field.
override emit<field name>.<expression>() as <field name>e.g. To change data in a field called "number" from a decimal number to a whole number:emit *override emit number.int() as numberThis will output the "number" data under the same field name ("number") but each record within that field will be converted to a whole number.
-
rename - renames a specified field name.
rename <old name> as <new name>
override emit
statement to all the records within a specified field, or to just the field name. You can only use rename
to rename a field name, not the records within the field.Output example
“output1”{emitfield1,field2,field3.replace(“-“, “”) as newfield3excludefield4,field5renamefield6 as foowherefield7 == “value”override emitfield8.toUpper as field8}output “output2”{emit *wherefield7 != “value”}
For a more extensive list of output-related keywords, see Configuring node output