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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Cherichoc-
Creator
Creator

tRestResponse Json not displaying all rows

Goal is to enter account nr on url then it pulls all accounts and devices linked to it.

 

My tRestresponse only displays one row as results 

 

{"LINK":{"accounts":{"accountnr":"EEE","entityname":"Ku","entid":93},"devices":{"devid":129,"devicename":"Ku Bha Service Station"}}}

 

While tlog displays all rows

{"LINK":{"accounts":{"accountnr":"EEE","entityname":"Ku","entid":93},"devices":{"devid":129,"devicename":"Ku "}}}
{"LINK":{"accounts":{"accountnr":"AAA","entityname":"Ku2","entid":93},"devices":{"devid":155,"devicename":"Ku2 "}}}

 

 

 

Labels (6)
12 Replies
Anonymous
Not applicable

If you want to add an array to the JSON you need to build it with a tWriteJSONField component and not a tXMLMap. Arrays are not native to XML so when the XML is converted to JSON it will return the data as a loop of elements.

 

I've just knocked up a quick example. It is very basic, but should give you an idea. My job looks like this...

 

0683p000009MA32.png

 

My tFixedFlowInput component holds this data....

0683p000009MA37.png
I'm aiming for the "newColumn1" values to be in an array. 

I configure the tWriteJSONField's mapping as below.....

0683p000009M9Yy.png

Then I set the "Group By" field to group by the "newColumn" column (...the column I set my Loop on).

 

0683p000009M9wS.png

 

The output I get can be seen below....

 

{"rootTag":{"newColumn":["newLine","newLine","newLine","newLine"],"newColumn1":"1"}}

....or in a more readable format.....

{
   "rootTag":{
      "newColumn":[
         "newLine",
         "newLine",
         "newLine",
         "newLine"
      ],
      "newColumn1":"1"
   }
}
Cherichoc-
Creator
Creator
Author

@rhall  that's great but my problem now is linking

 

restRequest-->tsetGlobalVar--->tdbRow--->tfixedFlowInput

It doesn't allow main link 

Anonymous
Not applicable

You don't need to use a tFixedFlowInput component. I simply used that to hardcode my example data. Your data will not be hardcoded. The only component you care about in my example is the tWriteJsonField