cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
aa12
Microsoft
Microsoft

How to display a nested array from Get call in a JSON response

Hello,
 
I am trying to get the following JSON to display. I want an array called "items" to show up on the page. I tried Concat(ThisItem.items, ","), but it only displays " ,,,," on the page(there are 4 items.) So the concat works, but the items are missing.
 
Here is a sample of the JSON.
 
"body": {
"items": [
"Extra Large: 4+ months",
"Large: 3-4 months",
"Medium: 2-3 months",
"Small: less 1 month"
],
"type": "String",
"isSuggested": false
 
Notice that items is a nested array. This is what I need to display.
 
More Info:
 
My app is structured as:
 
BrosweScreen:
On app.onStart, a GET call to a Custom Connector. Returns all relevant results. This works fine.
onClick"  The ID is set as a variable and a GET by ID request is issued. The return of this request is set to a variable, myMatchingList (This works fine.) Navigate to Detail Screen.
(Note that the info I want is in the Get by ID request. I have to make 2 calls to get this info. I can't combine them into one.)
 
The Get by ID returns a JSON response, which looks like:
 
"body": {
"items": [
"Extra Large: 4+ months",
"Large: 3-4 months",
"Medium: 2-3 months",
"Small: less 1 month"
],
"type": "String",
"isSuggested": false
},
 
So my info is in a nested array.

Detail Screen:
One result is displayed. It's the variable myChosenList. It's data type is record. This appears in a gallery. 
(Please note that I can't get a viewform or data table to display the result. I am not sure what the correct way to display a Record data type is.)
onClick of the next arrow =>navigates to EditScreen.
 
EditScreen
Here is where the issue is. 
 
On the edit screen I have a form. The form's Item is my variable, myChosenList, with a Data Type: Record. The form's DataSource is the call to the custom connector, also with a Data Type: Record.
When I add fields to the form, the items field throws an error. 
The default for the items_DataCard is thisItem.items,which is locked. When I unlock it to edit the Default value to "Concat(ThisItem.items, ", ")", I get ",,,," in the card. 
 
Can someone please help me?
 
1 ACCEPTED SOLUTION

Accepted Solutions
gabibalaban
Super User II
Super User II

Hi @aa12 ,

I think it's about an incorrect usage of concat function. Try:

Concat( ThisItem.items, Value &  ", " )

 

Hope it helps !

View solution in original post

2 REPLIES 2
gabibalaban
Super User II
Super User II

Hi @aa12 ,

I think it's about an incorrect usage of concat function. Try:

Concat( ThisItem.items, Value &  ", " )

 

Hope it helps !

View solution in original post

Hello, 


This works! 
As a bonus, I added
Left( Concat( myChosenPicklist.items, Value & ", " ), Len( Concat( myChosenPicklist.items, Value & ", " ) ) - 2 )

 

to get rid of the trailing comma space.

Thanks a lot!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (66,080)