Skip to main content Skip to complementary content

Custom Expression Builder

The Custom Expression Builder provides specific functions and operators to define package operations. Selecting from dropdown menus, users select one or more fields and then choose applicable functions and operators. The functions auto-populate in the package control and execute in a Pig script.

The expression builder displays available Fields, Function, and Parameter option tabs for insertion into the transform expression.

Hover over fields, functions, and parameters for tooltips

Accessing custom expression builder

The expression builder is accessed by selecting the icon expression builder (expression builder) icon from the field definition row. Expression builder is available in Router, Filter and Transform controls.

Acess expression builder by selecting its icon in field definition rows

Custom expression builder components

Fields: The expression builder extracts the fields from the source entity and presents them for selection in the function dropdown.

Function: Select from the following supported functions:

Operator

NOT

Not

IS NULL

Check if x is null

IS NOT NULL

Check if x is not null

*

Matches zero or more characters

/

Division

%

Returns the remainder of x divided by y (x%y)

+

Addition

-

Subtraction

< 

Less than

<=

Less than or equal to

>=

Greater than or equal to

> 

Greater than

==

Equal

!=

Not equal

AND

And

OR

Or

 CASE WHEN THEN ELSE END

Case <expression> [WHEN <expression> THEN <expression>] + [ELSE <expression>] END

Sample Use

Provides a brief explanation of the expression functionality.

Expression

Expands/Collapses the expression syntax window.

Adding UDF packages to Qlik Catalog

User Defined Functions (UDFs) can be added to Qlik Catalog so that they show up and are available in the custom expression builder. To make them available, place the UDF jar in the classpath (podium/WEB-INF/lib) and restart Tomcat. Note that UDFs in the new jar will show up only if they satisfy the criteria by which Qlik Catalog selects UDFs. For example, UDFs that take datatypes other than LONG and DOUBLE will be filtered out. If UDFs are in a new package (not the base package), they must be included in core_env.property pig.udf.discovery.basepackages (as a comma-separated value) to be scanned by the Spring Framework.

PIG UDFS package discovery, core_env property:

pig.udf.discovery.basepackages:org.apache.pig,com.podiumdata.pigudf,datafu

Custom expression creation

Select the expression builder icon on the relevant field definition to open the expression builder modal.

Select expression builder icon to the right of the field name to be defined

Once the expression builder opens, select the appropriate Pig function or operator. The expression window populates with the selected operator:

Selected operators populate into the expression field

Replace the expression placeholders with relevant fields and values. Field names are inserted without quotes, single quotes are added around field values.

For this example:

fruit (CASE <expression> WHEN <expression> THEN <expression> ELSE <expression> END)

 

can be edited to become:

(CASE fruit WHEN 'macintosh' THEN 'apple' ELSE fruit END)

Expression placeholders should be edited and replaced with values manually

Adjust syntax then Validate the expression. The new expression appears in the field mapping panel.

Upon validation, the new expression appears in the entity's expression panel

Save, Validate, and Execute the dataflow.

Observe that the value macintosh in the source entity now displays as 'apple' in the target entity.

INPUT/source entity (fruit transform)

Input source entity

OUTPUT/target entity (fruitt transfomed)

Ouput target entity

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!