web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collectiong relationsh...
Power Apps
Answered

Collectiong relationship data

(0) ShareShare
ReportReport
Posted on by

Hi All

 

I have a question, currently working on an offline canvas app on dataverse.

 

I was told to try and load everything into collections on app startup.

 

So basically i have a collection with filtered data called "colCampaigns".

 

When I load colCampaigns in a gallery, i get all my relevant items and on the onselect button in that gallery, I navigate to the next screen which displays a gallery with information about Campaign_Buildings. (called colBuildings)

NativeNass_0-1644237010530.png

How can i load this into a collection in OnStart?

Because when i try to do this, i get an error specifying that my column can't be accessed in this context:

NativeNass_1-1644237112202.png

 

When i don't load them in from the start, i can only navigate to that second screen when there is an internet connection first, and than it leverages the LoadData function after.

 

I need it in my Onstart so when i launch my app, i can immediatly leverage that collection from onstart instead of collecting it when pressing the button.

 

 

Thank you in advance

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Your patch and your for all are wrong..

    It should be something like this:

    ForAll( colCampaigns,

    Patch ( colDirtyCampaign_Buildings, Defaults(colDirtyCampaign_Buildings),

    {

    ...

    }

    )

    )

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Community Power Platform Member Profile Picture
    on at

    Hi @Nogueira1306 

     

    Thank you for your response.

     

    Well i basically have to capture every child relationship from my collection, into another collection:

    NativeNass_0-1644240278579.png

    Something like the above, do you know of any best practices around this? because it isn't really data from the colCampaigns (references to the Campaign Table). It's all the data from colCampaigns.Campaign_buildings (which references to the campaign_buildings Table).

     

    And my building_campaigns is actually a joined table with lookup values

    NativeNass_2-1644240564696.png

     

     

    Thank you in advance

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    I think your patch is wrong.

    Learn about Patch: 

     

    https://www.youtube.com/watch?v=gX5q_V3U8-s

     

    https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Community Power Platform Member Profile Picture
    on at

    Hi @Nogueira1306 

     

    I know my patch is wrong 🙂 

     

    I was hoping to getting to know some best practices in patching collection relationships to another collection 🙂

     

    Kind regards & thank you for your response

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Okay...Imagine you have a datasource called Test and the fields are Title, Subtitle and Body

    Patch(

    DATASOURCE,

    ITEM,

    {

    FIELDS TO UPDATE

    }

    )


    Imagine that you want to create a new item in Test 

     

    Patch(

    Test,

    Defaults(Test),

    {

    Title: "Title for Nogueira",

    Subtitle: "Name of my subtitle",

    Body: "Long text"

    }

    )

     

    Imagine that you want to edit a item in Test 

     

    Patch(

    Test,

    LookUp(Test, ID = 1),

    {

    Title: "Title for Nogueira",

    Subtitle: "Name of my subtitle",

    Body: "Long text"

    }

    )

     

     

    If you need additional help please tag me in your reply and please like my reply.
    If my reply provided you with a solution, pleased mark it as a solution ✔️!

    Best regards,
    Gonçalo Nogueira

    Check my LinkedIn!

    Check my User Group (pt-PT)!

    Last Post on Community

    My website!

  • Community Power Platform Member Profile Picture
    on at

    Hi @Nogueira1306 

     

    Well the issue here is the following:

    NativeNass_0-1644305981564.png

    I can patch the 'CampaignReference' without errors, but when i try to patch the GUID of the campaign building, i need to go to ThisRecord.Campaign_Buildings.Campaign_Buildings and it seems like patching that relationship is the problem.

     

    I know how to work with a default patch, I just don't know how to behave when trying to match relationship data into a collection..

     

    Kind regards & thank you for your response

  • Community Power Platform Member Profile Picture
    on at

     

    @Nogueira1306 

     

    I actually would need to start out as following, but that doesn't work either

     

    NativeNass_2-1644306498610.png

    Because i want to patch a collection based on all the campaign_buildings in the colCampaigns..

     

    Kind regards

     

  • v-jefferni Profile Picture
    on at

    Hi @Anonymous ,

     

    Since multi-level N:1 relationships are not supported within collections, I'm afraid there is no way to achieve your need in offline mode apps.

     

    The workaround could be create N:N relationship between the two tables without using the joined table. It's not necessary for dataverse.

     

    Best regards,

     

    Best regards,

    Community Support Team _ Jeffer Ni
    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Verified answer
    Community Power Platform Member Profile Picture
    on at

    Hi @v-jefferni 

     

    I eventually got it to work like this

    NativeNass_0-1644390686864.png

     

    I don't really care about the 'performance' warning since all of these actions are being processed on the App.OnStart.

     

    I'm not really a big fan of the OOB N:N relationships in Dataverse.. I started working with them in the beginning but when you start filtering etc in Canvas Apps, I was completely lost..

     

    Do you think the OOB N:N relationships are better than creating joined tables?

     

     

    Kind regards & thank you for your information

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard