cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mysticode
Level: Powered On

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!

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.

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.

mysticode
Level: Powered On

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?

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? 

mysticode
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,952)