EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB438985: XQuery script returns only 1 row while REST-JSON data source contains multiple rows in MicroStrategy XQuery Editor and Generator 10.x


Tianfeng (Jimmy) Jiang

Quality Engineer, Principal • MicroStrategy


This document shows one issue that XQuery script returns only 1 row while REST-JSON data source contains multiple rows in MicroStrategy XQuery Editor and Generator 10.x. This is due to incorrect JSON data in web services. The solution is to modify the JSON data and make it follow the JSON standard.

SYMPTOM:
XQuery script returns only 1 row while REST-JSON data source contains multiple rows in Strategy XQuery Editor and Generator (XEG) 10.x
STEPS TO REPRODUCE:

  • The JSON data of the REST-JSON web service contains 3 rows as shown below:
    
    { "firstName":"John" , "lastName":"Doe" },
    { "firstName":"Anna" , "lastName":"Smith" },
    { "firstName":"Peter" , "lastName":"Jones" }

  • In Strategy XEG, connect to this REST-JSON web service and generate the following XQuery script:
ka02R000000kV7tQAE_0EM44000000Q81G.png
  • Execute the XQuery script, but only one row is returned as shown below:
ka02R000000kV7tQAE_0EM44000000Q81L.png

CAUSE:
The JSON data returned from the REST-JSON web service doesn't match the JSON standard. There is no top level variable name for the sequence.
ACTION:
Contact Web services administrator to change the JSON response. The correct JSON data should be similar as below:


{
"employees": [
{ "firstName":"John" , "lastName":"Doe" },
{ "firstName":"Anna" , "lastName":"Smith" },
{ "firstName":"Peter" , "lastName":"Jones" }
]
}
​

The result in XEG is as below:

ka02R000000kV7tQAE_0EM44000000Q81V.png

  KB438985


Comment

0 comments

Details

Knowledge Article

Published:

November 22, 2017

Last Updated:

November 12, 2018