cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ashers82
Level: Powered On

New Record Part Patch, Part Data Table

Hi ,

 

I've a bit of a difficult one to explain, I want to Patch some fields manually instead of using the typical wizard data card because I am having a major ache with the datacards rearranging.

I can achieve this fine when I am editting an existing record but when I want to create a new record I am unable of finding a way to patch as I'm previously using...

Patch(TicketLog, BrowseGallery_3.Selected , 
{Kit_for_Site_1: txt_Kit_required_1.Text, 
Kit_for_Site_2: txt_Kit_required_2.Text,  
Kit_for_Site_3: txt_Kit_required_3.Text, 
Kit_for_Site_4: txt_Kit_required_4.Text, 
Kit_for_Site_5: txt_Kit_required_5.Text});

which obviously selects the gallery record.

I thought "ThisItem" should work but that gives me a "Recognize" error.

Any help would be greatly appreciated

3 REPLIES 3
Highlighted
Super User
Super User

Re: New Record Part Patch, Part Data Table

If you want to create a new record you just need to change the second parameter of the patch function. Instead of BrowseGallery_3.Selected to update an existing record you need Defaults(TicketLog) to create a new record.

 

Patch(TicketLog, Defaults(TicketLog) ,
{Kit_for_Site_1: txt_Kit_required_1.Text,
Kit_for_Site_2: txt_Kit_required_2.Text,
Kit_for_Site_3: txt_Kit_required_3.Text,
Kit_for_Site_4: txt_Kit_required_4.Text,
Kit_for_Site_5: txt_Kit_required_5.Text});



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Microsoft v-siky-msft
Microsoft

Re: New Record Part Patch, Part Data Table

Hi, @Ashers82 ,

 

To solve your problem, you should use Patch with the Defaults function to create new records as below.

Patch( Customers, Defaults( Customer ), { Name: “Contoso” } )

 So you need to modify the second parameter of Patch function in your formula. Use Defaults(TicketLog)  instead of BrowseGallery_3.Selected .

The formula should be like this:

Patch(TicketLog, Defaults(TicketLog) ,
{Kit_for_Site_1: txt_Kit_required_1.Text,
Kit_for_Site_2: txt_Kit_required_2.Text,
Kit_for_Site_3: txt_Kit_required_3.Text,
Kit_for_Site_4: txt_Kit_required_4.Text,
Kit_for_Site_5: txt_Kit_required_5.Text});

For more information, please refer to the doc: Patch function

 

Best regards,

Sik

Ashers82
Level: Powered On

Re: New Record Part Patch, Part Data Table

Thank you for the reply however when I do this I get two new records on the basis that I already have about 20 other fields being created using the datafield method.

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,207)