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

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Ensuring someone fills in Sub dataset

(1) ShareShare
ReportReport
Posted on by 33

Hi all,

 

So I have a form that people are filling in the "Main Data" and then a number of subforms that they fill in other data that have a 1 to Many relationship with the data on the "Main Form".  I have the data being stored in sharepoint lists and most of this seems to work.

 

I have done a few things to make sure people fill in the sub forms - so for instance they HAVE to click the new item button on the sub form before the "save" button on the main form is visible.  But to be honest its a little bit of a misdirection.

 

Because the sub form data is related to the main form data, you cannot create the sub data without the PK from the primary data.  And therefore I have to save the data before I am forcing them into the subform.  I hope this makes sense up to now.

 

So what should i do in my design to make sure they fill in the sub forms?  Any ideas?

 

Many thanks

 

Dan 

Categories:
I have the same question (0)
  • KeithAtherton Profile Picture
    3,690 Most Valuable Professional on at
    Re: Ensuring someone fills in Sub dataset

    Hi @DanFountain,

     

    Could the main form "Save" button OnChange action contain validation to check that the sub forms have been completed, such as checking if the controls contain non-blank values?

     

    Instead of using the form control SubmitForm method, the Patch function can be called to submit the main form and all sub forms in order.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Connect with me online.

  • daniel.fountain@willistowerswatson.com Profile Picture
    33 on at
    Re: Ensuring someone fills in Sub dataset

    Hmm.... I am not sure.

     

    I think I have made it more confusing by saying Form at the times i mean Screen.

     

    So let me try again.....

     

    There is a main screen, with a main form on it.  Data wise it has a 1:M relationship to the data on the subscreen the grid & form that maintain the multiple records that are under the single record in the 1:M relationship.  Currently I Patch the Items into this grid so i can push the ID of the "one" side of the relationship onto the record.

     

    So with what you have said I cannot understand is how i would hold these records somewhere without submitting them as the grid is attached to the dataset.  I hope this makes sense.

     

    D

  • Verified answer
    KeithAtherton Profile Picture
    3,690 Most Valuable Professional on at
    Re: Ensuring someone fills in Sub dataset

    Thanks for the info. The approach I had in mind was to store the "parent" record in a variable and the related "children" records in a collection. For example:

    // Store parent record as variable.
    Set(gblParentRecord,
     {
     Field1: "Value1",
     Field1: "Value1",
     // ...
     }
    );
    
    // Store related records as a collection.
    ClearCollect(colRelatedRecords,
     // ...
    );

     

    Then perform any validation, e.g. CountRows(colRelatedRecords) > 0.

     

    Then call the Patch function for the gblParentRecord, obtain its PK, then patch all related records.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Connect with me online.

  • daniel.fountain@willistowerswatson.com Profile Picture
    33 on at
    Re: Ensuring someone fills in Sub dataset

    I am definitely going to try that as a solution.  Many thanks for your time and patience 🙂

  • KeithAtherton Profile Picture
    3,690 Most Valuable Professional on at
    Re: Ensuring someone fills in Sub dataset

    You're welcome! Thanks for the update 🙂


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.
    Connect with me online.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Chiara Carbone – Community Spotlight

We are honored to recognize Chiara Carbone as our Community Spotlight for November…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 714 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 419 Super User 2025 Season 2

#3
developerAJ Profile Picture

developerAJ 243

Last 30 days Overall leaderboard