cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alex_m8519
New Member

Patch Function Changing data in record columns that were previously patched.

Hello,

 

Currently I am working on an app that tracks experimental chemical formulas and their physical properties week by week. I made a collection and a flow that exports the formulas to a SharePoint list. I've also created a lookup function where users can lookup a previous formula and input new data week by week. To do this I made a separate screen using a patch function to update the records. The problem is that when the record is updated it removes the data from the previous update session. I'm thinking since the week by week updates are all tied to the same button it updates the previous weeks info as a blank. The code is as follows:

 

Patch('Dispersion Formulations',Gallery2.Selected,{'Final SME (kwh/kg)': fsme_1.Text,
'DOM FID': FFID_1.Text,
'Product Density (g/ml)': pdens_1.Text,
'DLD %':'Disp%'.Text,
'SLD %':'sol%'.Text,
'DOM VISC':domvisc.Text,
'WK 1 80C FID':wk180cfid.Text,
'WK 1 80C VISC':'80cvisc'.Text,
'WK 1 FID':wk1fid.Text,
'WK 2 FID':wk2fid.Text,
'WK 3 FID':wk3fid.Text,
'WK 4 FID':wk4fid.Text,
'WK 5 FID':wk5fid.Text,
'WK 1 VISC ':wk1visc.Text,
'WK 2 VISC ':wk2visc.Text,
'WK 3 VISC':wk3visc.Text,
'WK 4 VISC':wk4visc.Text,
'WK 5 VISC':wk5visc.Text});
Navigate(updatesuccess)

 

I've colored the text of the code to try and explain the succession. Date of manufacture (Green), week1(red), week2 (pink), week 3(blue), week 4(brown), week 5(black). I don't want the user to have to re-enter the previous weeks data. Is there a way around this? Do I have to make separate screens and buttons to separate the data? Any help would be most appreciated.  

3 REPLIES 3
ANB
Resolver I
Resolver I

Hi @alex_m8519 ,

Hope you are doing well!

If I understood your requirement correctly, You want to patch the data in SharePoint in pieces on weekly basis.

Then first you need to get the information about in which week currently the experimental chemical formulas is, then based on different week you will patch the different information to avoid a user to re-enter previous week data.

 

Then using switch function you need to patch the data. Example:

Switch(CurrentWeek, 

Date of manufacture, 

Patch('Dispersion Formulations',Gallery2.Selected,{'Final SME (kwh/kg)': fsme_1.Text,
'DOM FID': FFID_1.Text,
'Product Density (g/ml)': pdens_1.Text,
'DLD %':'Disp%'.Text,
'SLD %':'sol%'.Text,
'DOM VISC':domvisc.Text}),
week1,
Patch('Dispersion Formulations',Gallery2.Selected,{'WK 1 80C FID':wk180cfid.Text,
'WK 1 80C VISC':'80cvisc'.Text,
'WK 1 FID':wk1fid.Text,
'WK 1 VISC ':wk1visc.Text}),
week2,
Patch('Dispersion Formulations',Gallery2.Selected,{'WK 2 FID':wk2fid.Text,'WK 2 VISC ':wk2visc.Text}),
week3,
Patch('Dispersion Formulations',Gallery2.Selected,{'WK 3 FID':wk3fid.Text,'WK 3 VISC':wk3visc.Text}),
week4,
Patch('Dispersion Formulations',Gallery2.Selected,{'WK 4 FID':wk4fid.Text,'WK 4 VISC':wk4visc.Text}),
week5,
Patch('Dispersion Formulations',Gallery2.Selected,{'WK 5 FID':wk5fid.Text,'WK 5 VISC':wk5visc.Text}));

Navigate(updatesuccess)

 

I hope this helps.

 

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.

Thanks,

ANB

 

 

I think you understand correctly. The only catch is, the user will update at will. For example they may enter data on a Tuesday and then the week after enter data on a Wednesday or Friday. So, I don't think this can be a scheduled task. 

I do agree that I need to separate my patches by week, but I would like to know if they can all be triggered with the same button. 

I'm not sure I fully understand the "Switch" function. I tried separating my patches into weeks like so:

 

Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'Final SME (kwh/kg)': fsme_1.Text,
'DOM FID': FFID_1.Text,
'Product Density (g/ml)': pdens_1.Text,
'DLD %': 'Disp%'.Text,
'SLD %': 'sol%'.Text,
'DOM VISC': domvisc.Text
}
);
Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'WK 1 80C FID': wk180cfid.Text,
'WK 1 80C VISC': '80cvisc'.Text,
'WK 1 FID': wk1fid.Text,
'WK 1 VISC ': wk1visc.Text
}
);
Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'WK 2 FID': wk2fid.Text,
'WK 2 VISC ': wk2visc.Text
}
);
Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'WK 3 FID': wk3fid.Text,
'WK 3 VISC': wk3visc.Text
}
);
Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'WK 4 FID': wk4fid.Text,
'WK 4 VISC': wk4visc.Text
}
);
Patch(
'Dispersion Formulations',
Gallery2.Selected,
{
'WK 5 FID': wk5fid.Text,
'WK 5 VISC': wk5visc.Text
}
);
Navigate(updatesuccess)

 

This didn't work because all the code is on one button. I think my next step is to make separate screens for each week and patch it that way. 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (1,996)