Functions, field names and variables - Data360_Analyze - Latest

Data360 Analyze Server Help

Product type
Software
Portfolio
Verify
Product family
Data360
Product
Data360 Analyze
Version
Latest
Language
English
Product name
Data360 Analyze
Title
Data360 Analyze Server Help
Copyright
2024
First publish date
2016
Last updated
2024-11-28
Published on
2024-11-28T15:26:57.181000
CAUTION:
This topic relates to Data360 Analyze Script which is the language that is used in some deprecated nodes. If you are looking for help configuring the Python-based nodes, see Python scripting.

What is a function?

A function is a pre-built instruction that performs an operation and returns a value. The following syntax is used with functions:

function(parameter1, parameter2...)

Or, the first parameter can also be specified as follows:

parameter1.function(parameter2...)

Function names are written in lowerCamelCase, that is, the first word is written in lower case and subsequent words have the first letter capitalized (for example, toDate or deleteFile).

Double quotes or single quotes?

  • Use single quotes to refer to field names.

If the field name that you are referencing contains any spaces, or starts with a number, the field name must be written inside single quotes.

• fieldName # Does not need to be enclosed within single quotes because the field name does not contain any spaces and starts with a letter.• 'field Name' # Must be enclosed within single quotes because the field name contains a space.• '1fieldName' # Must be enclosed within single quotes because the field name starts with a number.

  • Use double quotes to indicate literal text (not a field).

emit *where type == "Direct Debit"

How do I define a variable?

A variable is a container that holds information.

Variables are defined by stating a name and what information they should contain. Variable names are specified in the following format, where the variable name is written on the left and the expression that identifies the information that it contains is written on the right:

<variable name> = <expression>

After a variable has been defined, it can then be referenced in an emit statement. Variables are useful when you are dealing with numerous edits as they can help to keep the coding cleaner and easier to read.

Note: A variable name must begin with a letter or underscore and can only contain alphanumeric characters and underscores.

1. Variable "orderMore" is defined. This statement must be placed before the emit statement:

orderMore = if UnitsInStock + UnitsOnOrder < Desired then "Yes" else "No"

2. Variable is referenced in an emit statement:

emit *, orderMore

In this example, "orderMore" will be included as a new column in the output.

Tip: Do not confuse the assignment operator (=) with the equality operator (==).While = assigns a value, == checks if two things are equal.