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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

tWriteJSONField loop bug ?

Hi,

I'm trying to make a JSON file out of a tMySQLInput and a tMap but it comes out a bit wrong, the loop seems not to be done properly.



Here is the JSON schema :



And here is the output :

{
  "cliTemplateCommand":{
     "targetDevices":{
        "targetDevice":{
           "targetDeviceID":"5010",
           "variableValues":{
              "variableValue":{
                 "name":"param",
                 "value":"Up01;Up02"
              }
           }
        }
     },
     "templateName":"auto_configure"
  }
}{
  "cliTemplateCommand":{
     "targetDevices":{
        "targetDevice":{
           "targetDeviceID":"5011",
           "variableValues":{
              "variableValue":{
                 "name":"param",
                 "value":"Up01;Up02"
              }
           }
        }
     },
     "templateName":"auto_configure"
  }
}



I'm getting an error from my JSON validator because of the multiple root elements.

Instead I was expecting something more like that :

{
  "cliTemplateCommand":{
     "targetDevices":{
        "targetDevice":{
           "targetDeviceID":"5010",
           "variableValues":{
              "variableValue":{
                 "name":"param",
                 "value":"Up01;Up02"
              }
           }
        }
     },
     "targetDevices":{
        "targetDevice":{
           "targetDeviceID":"5011",
           "variableValues":{
              "variableValue":{
                 "name":"param",
                 "value":"Up01;Up02"
              }
           }
        }
     },
     "templateName":"auto_configure"
  }
}



There, the "targetDevice" is correctly looped.

Is this a known bug or maybe I misunderstood something ?

Thanks.

Cardiganup.

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Hi 
Add a new column in the output table of tMap for used as group element laster, and set a fixed value to it.  On tWriteJasonField, define the group element. 
Best regards
Shong