Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
IanM
Contributor III
Contributor III

extract key value pairs.

Hello, I'm having problems converting an extract that is being presented in Key/Value pairs. The following is an example:

A
groupNbr|04512345
language|jp
RangeNumber|2550xxxxx
LifecycleStatus|60
manufacturerPartNumber|Dxx
manufacturerPartNumberFormatted|Dxx
baseUnitOfMeasure|EA
salesUnitOfMeasure|BG
packSize|20
packType|FINISHED
additionalSearchTerms|
imagePrimary|F045xxxx.jpg
rangeID|PCSR_11xxx
subRangeID|PCSSR_35xxxx
subRangeName|xDL
familyID|PSF_43xxxx
familyName|xxxxxxxx
sectionName|xxxxxxxxxxxxxx
searchAttributeNameValue|xxxxxxxxxxxxxxxxxxxx
EOR




My issue is that not all pairs are always present. They always have a groupNBR and a language but the next record may not, for example, have a record for 'imagePrimary' or 'sectionName' so it needs to be able to cope with varying record format.

I have found MaheshMP's  tFileInputKeyValue custom component and though it works very well in foreground mode, it returns corrupted data when run as an exported job. Some files complete, others fail completely or have partial data. It does not error and I have not been able to identify the cause.


Does anyone have any recommendations for how I could use standard components to solve this please, or any other suggestions?


Many thanks

Ian

Labels (2)
1 Reply
IanM
Contributor III
Contributor III
Author

Worked it out myself...
Create a dummy record as the first record of the data file with all the possible Key Value pairs in the required order. Can then use tPivotToColumnsDelimited to generate the records.
As long as the dummy values are at the beginning of each file, the format will always match.