Skip to main content
Question

DataLogicController

  • 25 June 2024
  • 0 replies
  • 27 views

FME Hub user mark2atsafe just uploaded a new transformer to the FME Hub.

Description

This transformer controls the flow of features according to which input ports receive data. Various logic tests (AND, OR, etc.) can be applied to determine which combination of ports is a pass or fail.

The main purpose is to direct data according to the output of previous transformers. For example, a workspace should continue processing if - and only if - the previous two transformers both return data. If one of them fails, the workspace should terminate.

Parameters

Ports to Use

Which input ports should form part of the logic tests. The transformer can use any number of ports, from 1 to 4.

Logic to Use

Which logic test to apply to the input ports. There are various tests, such as AND, OR, and XOR.

Functionality and Logic

We can say that there are four different possible outcomes:

NONE: No ports receive data

ALL: All ports receive data

SOME: Some ports receive data

These can be combined into various tests that have standard names in computer science:

AND:

The test is a success if ALL of the chosen input ports receive data.

If SOME or NONE of the ports fail to receive data, the test is a failure.

OR:

The test is a success if SOME or ALL of the chosen input ports receive data.

If NONE of the ports at all receive data, then the test is a failure.

NAND:

The test is a success if NONE or only SOME of the chosen input ports receive data.

If ALL of the chosen input ports receive data, the test is a failure.

NOR:

The test is a success if NONE of the chosen input ports receive data.

If SOME or ALL of the chosen input ports receive data, the test is a failure.

XOR:

The test is a success if only SOME of the chosen ports receive data.

If ALL or NONE of the chosen ports receive data, the test is a failure.

XNOR:

The test is a success if ALL or NONE of the chosen ports receive data.

If only SOME of the ports receive data, the test is a failure.

Usage Notes

Incoming features are routed to either the Passed or Failed output port, depending on the result of the test.

Features exit with the number of its input port added as an attribute. This allows the data to be separated back into its individual streams, as necessary.

Depending on the input and tests, sometimes there would be no output. For example, the NOR test is only a success if there is no input data. In these cases, a single feature is output from the appropriate port (Passed/Failed) to represent the result.

Features entering an input port that is not used (i.e. not specified in the Ports to Use parameter) exit through an Unused output port.

By using only the first port of the transformer, this makes a handy alternative to the NoFeaturesTester transformer.

Example

A workspace should continue processing if - and only if - the previous two transformers both return data. If one of them fails to produce any output, the workspace should terminate.

The output from one previous transformer is connected to Input:1 port.

The output from the other previous transformer is connected to Input:2 port.

The Ports to Use parameter is set to 1-2 (i.e. the first two ports).

The Logic to Use parameter is set to AND (i.e. both ports must receive data).

The Passed output port is connected to further processing steps.

The Failed output port is connected to a Terminator transformer.



Would you like to know more? Click here to find out more details!
This post has been closed for comments