Hi,
I have a few tables that seem to mess with each other and I can't figure out why. What happens is when I save the detail within the App, the company and/or the contacts that are connected to audit sometimes are no longer connected to the audit. I can see this when I listed all my audits in a gallery and the company field is now blank and I have to re-add it in the audit. When happens then, sometimes, is that the contacts for that company also are removed. The code I use to "save" any changes is on the bottom. If
Here are my main tables and how the PowerApp works.
- Audit
- Company (each company has multiple contacts from the contacts table)
- Contacts (contacts can be created/edited from App)
Solved! Go to Solution.
Hi @ez1138 ,
Try this
If(
EditForm_Audits_Company.Mode = FormMode.New,
Patch(
'[dbo].[audit]',
Defaults('[dbo].[audit]'),
EditForm_Audits_Company.Updates
);
Navigate(BrowseGallery_Audits),
Patch(
'[dbo].[audit]',
{auditID:BrowseGallery_Audits.Selected.auditID},
EditForm_Audits_Company.Updates
);
Navigate(Screen_Detail_Audits_Company)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @ez1138 ,
What exactly are you doing with the second Patch on the same list using the same data? The first is a new record, but you are then updating with the same data.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi Warren, thanks for the reply.
I'm not an expert, obviously. I just pulled this code from a past "back when", and it seemed to work. Are you saying I should just dump the last portion of the code? I struck it out.
Hi @ez1138 ,
Actually forget that - I missed the top bit - must have read too quickly. Do you have a unique identifier in your record, if so, what is its name and type.
Yes. Here they are.
For my audit table, it's audit_ID, company is company_ID and contacts is contacts_ID.
Hi @ez1138 ,
Try this
If(
EditForm_Audits_Company.Mode = FormMode.New,
Patch(
'[dbo].[audit]',
Defaults('[dbo].[audit]'),
EditForm_Audits_Company.Updates
);
Navigate(BrowseGallery_Audits),
Patch(
'[dbo].[audit]',
{auditID:BrowseGallery_Audits.Selected.auditID},
EditForm_Audits_Company.Updates
);
Navigate(Screen_Detail_Audits_Company)
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
Hi @ez1138 ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.
Visit my blog Practical Power Apps
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
204 | |
71 | |
51 | |
49 | |
20 |
User | Count |
---|---|
260 | |
121 | |
85 | |
76 | |
72 |