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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Create JSON from Query with tjsonDocOutput

Hello,

I am new to the tjsonDoc* components. I read the documentation from jlolling but still not sure how to create the following json from a (one?) database query

{
"data": {
"masters": [
{
"master_number": "12345678912",
"origin": "BER",
"destination": "FRA",
"items": 2
}
],
"items": [
{
"master_number": "12345678912",
"item_number": "1",
"item_origin": "BER"
},
{
"master_number": "12345678912",
"item_number": "2",
"item_origin": "BER"
}
]
}
}

 

Is it neccessary to query the database twice, once for master and again for child data (items)?So far I created the following:

0683p000009M92T.png

But I get (as configured in the job) a json array with objects containing master and item data in it:

 "masters": [
    {
  	"master_number" : "12345678912",
  	"origen" : "BER",
  	"destination" : "FRA",
  	"items" : 2
 	"item_number": "1",
        "item_origin": "BER"
    }, 
    {
  	"master_number" : "12345678912",
  	"origen" : "BER",
  	"destination" : "FRA",
  	"items" : 2
 	"item_number": "2",
        "item_origin": "BER"

    }, 
...

So it puts every row and corresponding columns to one new json objects. How to split it into one master and its items? I guess I should use forreign key structure?

 

Could someone give me a hint for the basic job structure?

Labels (2)
0 Replies