Ask Your Question

Revision history [back]

This pipeline is behaving as expected. We can use Expression Evaluator to see a bit more detail of what's going on.

Here's my test pipeline:

image description

Here's my test data:

image description

My Expression Evaluator will show me the value of the field /f4 and the value of the condition ${record:value('/f4') == 'success'}

image description

My Stream Selector will send records that match ${record:value('/f4') == 'success'} to stream 1, and all others to stream 2

image description

Now, in preview, this is what I see in the Expression Evaluator:

image description

For the first record, the value of the expression ${record:value('/f4')} is null. There's no error here - this EL function is defined to return null if the field does not exist. Consequently, since null != 'success', the value of the condition is false. For the second record, the values are 'success' and 'true', as expected.

Now, looking at the Stream Selector:

image description

The first record does not match the condition ${record:value('/f4') == 'success'}, so it goes to stream 2. The second record does match, so it goes to stream 1.

Note that, if the existence of the field is important, you can use record:exists('/path/to/field') either on its own or in an expression with record:value('/path/to/field').

This pipeline is behaving as expected. We can use Expression Evaluator to see a bit more detail of what's going on.

Here's my test pipeline:

image description

Here's my test data:

image description

My Expression Evaluator will show me the value of the field /f4 and the value of the condition ${record:value('/f4') == 'success'}

image description

My Stream Selector will send records that match ${record:value('/f4') == 'success'} to stream 1, and all others to stream 2

image description

Now, in preview, this is what I see in the Expression Evaluator:

image description

For the first record, the value of the expression ${record:value('/f4')} is null. There's no error here - this EL function is defined to return null if the field does not exist. Consequently, since null != 'success', the value of the condition is false. For the second record, the values are 'success' and 'true', as expected.

Now, looking at the Stream Selector:

image description

The first record does not match the condition ${record:value('/f4') == 'success'}, so it goes to stream 2. The second record does match, so it goes to stream 1.

Note that, if the existence of the field is important, you can use record:exists('/path/to/field') either on its own or in an expression with record:value('/path/to/field').

. If records that are missing a field should be sent to the error stream, then you can simply list that field in the stage's required fields configuration:

image description

Now preview shows that the first record is sent to error:

image description