cancel
Showing results for 
Search instead for 
Did you mean: 

Omit missing fields in a Mapper

philliperamos
Contributor

Hi community,

I would like to create a Master Mapper of sorts that will accept an input stream of let’s say field1 and field2, and just output those fields.
image

Mapper:
image TEST_MasterMapper_2020_02_11.slp (4.9 KB)

I’ve uploaded a sample pipeline of what I would like to achieve.

Thanks everyone in advance!

3 REPLIES 3

dmiller
Former Employee

I’m trying to understand the ask. Are you saying you want a kind of universal Mapper configured to accept n number of fields, but if a field is not in the input, not to write that field to the output (instead of writing it with a null value)?


Diane Miller

That’s correct.
I essentially have 25+ data sets to extract from a source system, and from those data sets, there are about 50 common fields.
Hence, a master mapper with the common fields, that will ignore the ‘missing’ fields.

In your example pipeline given, if you enable the Null-safe access in the mapper, then attach another mapper at the end with the expression: $.filter((value, key) => value != null) mapped to the target: $ will give you all the values of your common mappings that are not null.