TDE - Transform Array Occurrence as Column

by haritrichy   Last Updated July 12, 2019 14:26 PM - source

In TDE, I’m trying to transform and make the array occurrences as columns. Is it possible?

In ODH, we have harmonized JSON payloads that utilize array objects to store repeating occurrence in code & value (aka key value) format. An example given below, “Addr” array that carries multiple addresses of a customer.

{"customer":{
    "Name": "Mike John", 
    "Addr": [
    {
    "AddrTypeCd": "MailingAddress", 
    "Addr1": "911 FORBES AVE", 
    "Addr2": "SUITE XXX", 
    "CityName": "asdfasfd", 
    "StateProvCd": "PA", 
    "PostalCode": "15219"
    }, 
    {
    "AddrTypeCd": "OfficeAddress", 
    "Addr1": "911 Watson AVE", 
    "Addr2": "SUITE XXX", 
    "CityName": "asdfasfd", 
    "StateProvCd": "CT", 
    "PostalCode": "15119"
    }
    ]
    }}

For above example, I want the TDE view to return customer name, mailing address, office address as a single row. Is it doable? I couldn’t find any relevant TDE documentation. If it is possible, can you please get me a sample TDE view definition or any reference document?

PS: I’d like to avoid harmonization changes to make every occurrence as a JSON property and also avoid separate TDE view for every array object (due to SQL joins).

Tags : marklogic


Related Questions





Multi-Facet Interactions

Updated July 15, 2018 20:26 PM

Marklogic function to convert excel file to XML?

Updated February 21, 2017 14:26 PM