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

Adding Relational records when creating the one to many record SQL

Hi All,

 

I've been given a SQL database to work with that stores fault information. There is a one-to-many relationship to a table of images that relate to the fault. 

 

When an engineer attends a fault a record is to be created in the fault table in the database and the engineer may upload photo's of the fault to the database, there may be more than one image so there is a one to many relationship between the fault table and the photo's table.

 

In powerapps, I'm struggling with how to get records written, do I need to create the fault report first, then try and reference the primary key of the fault report to pass as the foreign key for the photo's,

 

OR

 

Can I write the whole lot in one go and pass the photo's in as a collection in the form, or patch statment?

 

How would you go about doing it?

 

Many thanks in advance to all that repond.

3 REPLIES 3
Lisabel0
Level 8

Re: Adding Relational records when creating the one to many record SQL

Please explain more about what you want to achieve adding the controls in PowerApps. For example, I want to create one record with edit form, and then reuse the image control in this form to create a new record of another data source.

Re: Adding Relational records when creating the one to many record SQL

Thats correct. For example, I want to create a record that is for a whole event say the delays to a que at a checkout, so I would log that in a data source called QueRecords. Then When the QueRecord is create on the same page, I would like to create a record of the delay to the que so I can have multiple que delay events in a data source called Que delays linked to the Que record. I want to create them at the same time but how do I identify the que record for the que delay before creating it. Or do I have to create the que record and then use some filter or lookup to try and find the correct record.
seadude
Level 10

Re: Adding Relational records when creating the one to many record SQL

Really need a reply on this topic! I'm facing the same issue:

 

How do you Patch multiple SQL records that have PK/FK relationships?