โ08-23-2020 01:29 AM
Hi,
I am reading multiple json files from source. where column names and column type are varying from file to file.
For example: In one file, column name is coming as an array and in another file it is coming without array. But for my use case I donโt need to worry about the column type.I only want data to be stored.
Now my question is:
I have below two different columns coming from two different file:
Col 1: jsonPath($, โ$OT.Refs.TripRef[*][โ@BookingRefโ]โ)
Col 2: OT.Refs.TripRef[โ@BookingRefโ]
I am reading one by one each file and I want to do following thigs:
For Example:
is not available in the file then select then Column name =Solved! Go to Solution.
โ08-24-2020 04:50 AM
Hi @ppankaj88,
You can try with the โhasPathโ object function and Conditional(Ternary) operator.
ex: $.hasPath(โcol1โ) ? $col1 : ($.hasPath(โcol2โ) ? $col2 : โโ)
The above expression will check:
Also, I am attaching a simple pipeline as an example:
SL_Community_2020_08_24.slp (4.8 KB)
Hope this helps.
Regards,
Spiro Taleski
โ08-24-2020 04:50 AM
Hi @ppankaj88,
You can try with the โhasPathโ object function and Conditional(Ternary) operator.
ex: $.hasPath(โcol1โ) ? $col1 : ($.hasPath(โcol2โ) ? $col2 : โโ)
The above expression will check:
Also, I am attaching a simple pipeline as an example:
SL_Community_2020_08_24.slp (4.8 KB)
Hope this helps.
Regards,
Spiro Taleski
โ08-26-2020 05:05 AM
Thank you for providing solutionโฆitโs worked for me