cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sasasale
Frequent Visitor

i use galary data and change a bit and want to save it as a new record create and use existing galary data witouth overwrite

hello thanks for reading this 

 

i want to use data from galary and want to change a litle and save it again i dont want to overwrite it i want to create a new record what do i nee to do because 

SubmitForm(EditForm1_1) is not the right code then it wil overwrite

 

 

thnx

sasasale

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @RandyHayes thank you for giving me some solutions and yes i changed excel into sharepoint and after that i used 

Patch(yourGallery.Selected, {ID:Blank()})

but this still doesnt work i mentioned when i change the comma , into ; it worked perfectly i think this is because im from Europe and you are from the USA but im happy you helped me in this mission accomplished   

so the correctline for me is  

Patch(BrowseGallery1.Selected; {ID:Blank()})

 thank you and you are so underrated on youtube you helped a lot 

regards Sasa Collijn

View solution in original post

8 REPLIES 8
BCLS776
Super User
Super User

To change a form into FormMode.New and prepare it to create a new record, run the NewForm() function first.

 

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
RandyHayes
Super User
Super User

@sasasale 

If you want to perform this, you will need to make sure your Form is in Edit mode and never in New mode.  When you specify New for a form, it produces an internal-to-the-form record based on the Defaults of your datasource.  You will have no access to that record to be able to modify it from your app (i.e. incorporating the Gallery data into the form.)

So, keep your form in Edit mode and utilize the following on your Item property of the form:

Patch(yourGallery.Selected, {ID:Blank()})

This will give you a form with all of the data from the gallery, and when you SubmitForm on the form, it will create a new record with that data and any changes you have made to it in the form.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

thanks for you reply but this doesnt work iwas looking at your youtube but cannot find anny simple code for it

 

 

sasasale
Frequent Visitor

i think you didnt understand the question i have my data in a tabel and want to use and change that data a litle and after i want to save it as a new Unique record so not overwritten like it standard do

@sasasale 

Well, there is a lot of missing information about your app and its design and purpose, so it is hard to pinpoint any exact solution to what you need. The provided suggestion is the basic for doing what you want.

 

So, some essential details...what is your datasource?  Are you ONLY requiring to select a gallery item and then make edits and save as new, or do you have other needs?

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

thank you again for trying to help me out in this @RandyHayes i appriciate this a lot

here are some details, I want to make an application for customers to custom and design there own cinnewals by starting from an example template and then configere it with customer dimensions and optional wishes.

 

database is in excel and the idea is to use  the data and start from a template example from the database and to add details to it and save it as an workorder for the customer with customermade dimensions and options of a cinnewalls

 

so i made the standard  galary and detail and edit screen but if i want to save it it overwrite the original and that is not what i want it need to have an uniqe customer order so i can cannot other processes onto it .

 

so the

SubmitForm(EditForm1_1) is not complete in my thoughts it needs more detail to save te information that we enter in the app.
 
hope i explanded a bit more so  you understand what i mean and what the problem is that i have for sure it wil be something small but thats like always haahaha
 
rgds sasa
 
RandyHayes
Super User
Super User

@sasasale 

Ah...Excel!!  The method that I provided is sufficient for SharePoint, Dataverse, SQL and others...but NOT Excel.

The Excel connector does not expose the primary key to the app, so there is no way to "blank it out" and have the form then submit a new item.

 

The only way to do this is to duplicate the selected item from your gallery - column by column!
For example, if you have an Excel table with a "Name", "Date" and "Customer" column (for example), then in your OnSelect of the gallery selection, you will need to implement this:

With(ThisItem,
   UpdateContext({lclCurrentRecord: { Name: Name, Date: Date, Customer: Customer } })
)

The above will exclude the hidden identity column and thus make the form think that it is a new record.

 

Then (Form still always in Edit mode), the Item property of the form would be lclCurrentRecord.

 

The above MAY or MAY NOT work for you.  It is a challenge with Excel as it kind of has a mind of its own.

 

Best to switch to at least SharePoint if you can.

 

 

When you SubmitForm, it will create a new item in your list with the values from the selected record and any changes made in the form.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Hello @RandyHayes thank you for giving me some solutions and yes i changed excel into sharepoint and after that i used 

Patch(yourGallery.Selected, {ID:Blank()})

but this still doesnt work i mentioned when i change the comma , into ; it worked perfectly i think this is because im from Europe and you are from the USA but im happy you helped me in this mission accomplished   

so the correctline for me is  

Patch(BrowseGallery1.Selected; {ID:Blank()})

 thank you and you are so underrated on youtube you helped a lot 

regards Sasa Collijn

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PWREduCon768x460.png

Join us at PWR EduCon - A Power Platform Conference

Learn from the top Power BI, Power Apps, Power Automate & Power Virtual Agents experts!

Top Solution Authors
Top Kudoed Authors
Users online (3,170)