Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 "}}}
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...
My tFixedFlowInput component holds this data....
I'm aiming for the "newColumn1" values to be in an array.
I configure the tWriteJSONField's mapping as below.....
Then I set the "Group By" field to group by the "newColumn" column (...the column I set my Loop on).
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" } }
@rhall that's great but my problem now is linking
restRequest-->tsetGlobalVar--->tdbRow--->tfixedFlowInput
It doesn't allow main link
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