cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Re: Powerapps problem accessing JSON collection

This did not work.

 

I think it is because "link" is a property of an object in my array, instead of being the primary object itself?

 

JSON Body:

[
  {
    "parent": {
      "display_value": "12345",
      "link": "https://demosite.com"
    },
    "size": "small",
    "shadow": "false",
  }
]

Schema used:

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "parent": {
        "type": "object",
        "properties": {
          "display_value": {
            "type": "string"
          },
          "link": {
            "type": "string"
          }
        }
      },
       "size": {
        "type": "string"
      }   
      "shadow": {
        "type": "string"
      }   
    }
  }
}

Hopefully this clears this up!

Highlighted
Super User
Super User

Re: Powerapps problem accessing JSON collection

This is the command I used to create the JSON in PowerApps for testing:

ClearCollect(
    colTest,
    {
        parent: {
            display_value: "123",
            link: "https://demo.com"
        },
        shadow: "false"
    },
    {
        parent: {
            display_value: "12345",
            link: "https://demo2.com"
        },
        shadow: "false"
    }
)

I'll try putting your sample and schema into Flow to test.

Highlighted
Super User
Super User

Re: Powerapps problem accessing JSON collection

I think there is a typo in the schema provided in your post - there should be a comma before the "shadow" as below:

{
  "type": "array",
  "items": {
    "type": "object",
    "properties": {
      "parent": {
        "type": "object",
        "properties": {
          "display_value": {
            "type": "string"
          },
          "link": {
            "type": "string"
          }
        }
      },
       "size": {
        "type": "string"
      },   
      "shadow": {
        "type": "string"
      }   
    }
  }
}

I created a Flow triggered by PowerApps with a Response step using the provided JSON and schema (with the correction noted above). I assigned the returned value to the collection colTest - the formulas previously posted worked for me.

Highlighted
Frequent Visitor

Re: Powerapps problem accessing JSON collection

I have checked my schema, and the comma is there. I typo'd in my post reply above.

 

In my current Gallery, my four labels have Text properties of: ThisItem.<column names here>


The gallery's Item property is set up to be: enhancements

 

I have a button, that is the following OnSelect property: ClearCollect(enhancements,EnhancementItems.Run())

Note: This was done to pull all the data from the Flow's JSON output.

 

All of my labels are successfully pulling in data so far for the Gallery.

 

Are you recommending I modify my ClearConnect property to specifically select the fields to put in from my Flow, instead of just pulling in all of them?

Highlighted
Super User
Super User

Re: Powerapps problem accessing JSON collection

I note in one of your earlier posts you are referring to .Parent.link

In the JSON it is .parent.link (lower case P).

Parent is an object you can reference (e.g. you can set the width of a label to Parent.Width).

Maybe this is causing the issue.

Can you try checking your capitalisation? 

Highlighted
Frequent Visitor

Re: Powerapps problem accessing JSON collection

In the labels, I tried:

First(enhancements).parent.link

and

ThisItem.parent.link

 

Both times the error is: Invalid use of '.'

 

As a test to make sure that the First property saw my data, I tried First(enhancement).sys_created_on (this is another column of data from my JSON output), and it created repeating data across my gallery entries:

image.png

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,114)