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

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
jerownimow
Contributor III
Contributor III

How to build a Loop XPath Query that will return both with records and without records on the child element?

Hello Folks,
I have these JSON responses:

 

/*******1 - JSON without child elements on record node************/
{
    "totalSize": 0,
    "done": true,
    "records": []
}
/*******2 - JSON with child elements on record node************/
{
    "totalSize": 2,
    "done": true,
    "records": [
        {
            "attributes": {
                "type": "Transaction_History__c",
                "url": "/services/data/v45.0/sobjects/Transaction_History__c/987654321"
            },
            "Id": "987654321"
        },
        {
            "attributes": {
                "type": "Transaction_History__c",
                "url": "/services/data/v45.0/sobjects/Transaction_History__c/123456789"
            },
            "Id": "123456789"
        }
    ]
}

First configuration:
0683p000009M8WM.pngwith XPath

 

For 1st response & 2nd response, respectively it has an output of:

0683p000009M8WR.pngwithXPath

2nd configuration:

0683p000009M8IW.pngBlank Loop XPath

For 1st response & 2nd response, respectively it has an output of:
0683p000009M8WW.pngw/oXPath

Now, what I want to achieve are these output:
0683p000009M8Pr.pngExpected Output
Can you please help me achieve this expected output? I believe it will be solved by correct mapping but I can't figure it out, have tried several combinations.
Thank you so much!

 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Hi 

Read by xpath and set the loop xpath to /root/records/attributes, you should be able to have the expected output, see

0683p000009M8ES.png0683p000009M7um.png

 

Hope it helps you!

 

Regards

Shong

View solution in original post

2 Replies
Anonymous
Not applicable

Hi 

Read by xpath and set the loop xpath to /root/records/attributes, you should be able to have the expected output, see

0683p000009M8ES.png0683p000009M7um.png

 

Hope it helps you!

 

Regards

Shong

jerownimow
Contributor III
Contributor III
Author

Thanks, Shong! Actually, that was an output of a tRESTClient. 

What I did was to separate the pipes for both with different Xpath to get the desired output and just link both of their tHashOutputs.