cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
miss_haley
Helper I
Helper I

Retain form data with lastsubmit - combobox formula

Hi I have read many post about this issue. I have the same user need -  managers need to enter many records that have similar values and only some slight changes. 

 

My goal is to let user have option to enter the data and duplicate it for another entry or just enter it a single time and have the form reset. 

 

I follow this thread:

https://powerusers.microsoft.com/t5/Building-Power-Apps/New-form-without-resetting-the-fields/m-p/14...

 

All works well,  I don't know how I can add the if condition into the Item property of my Supplier combobox because it is using a filter function already for better searching.  When I type in formula it gives me error - expected table value

 

 

 

Capture.PNG

 

error.PNG

1 ACCEPTED SOLUTION

Accepted Solutions

@miss_haley 
You could try this general approach 🙂

 

Put this code in the Submit button's OnSelect property

Set(varDuplicate, false);
SubmitForm(Form1);

 

Put this code in the Submit & Duplicate button's OnSelect property

Set(varDuplicate, true);
SubmitForm(Form1);

 

And then use this code in the OnSuccess property of the Form

NewForm(Form1)

 

Then, say the user clicks "Submit & Duplicate" and you want to have a Combobox show the last form's values.  Put this code in the Default value of the ComboBox

If(varDuplicate=true, Form1.LastSubmit.ColumnName, Blank())

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

9 REPLIES 9
mdevaney
Super User
Super User

@miss_haley 
Hello there!  I am wanting to understand your goal a little bit better.

 

Do you have two buttons on your form: "Submit" and "Submit & Duplicate"?
Do you want to have all the fields on the form retain their values? Or just this one checkbox?

 

Let me know

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Hi @mdevaney to answer:

 

Do you have two buttons on your form: "Submit" and "Submit & Duplicate"?

Yes, exactly - it might be redundant since there is a reset button as well. 


Do you want to have all the fields on the form retain their values? Or just this one checkbox?
I want most of the fields to retain their value if user select "Submit & Duplicate" except for the Qty fields. However, this combobox is causing issue. 

 

I try set context variable for the buttons and use those in my if statement to check which button is selected and therefore whether to have the field with lastsubmit data or default

@miss_haley 
You could try this general approach 🙂

 

Put this code in the Submit button's OnSelect property

Set(varDuplicate, false);
SubmitForm(Form1);

 

Put this code in the Submit & Duplicate button's OnSelect property

Set(varDuplicate, true);
SubmitForm(Form1);

 

And then use this code in the OnSuccess property of the Form

NewForm(Form1)

 

Then, say the user clicks "Submit & Duplicate" and you want to have a Combobox show the last form's values.  Put this code in the Default value of the ComboBox

If(varDuplicate=true, Form1.LastSubmit.ColumnName, Blank())

 

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

Hi @mdevaney,

I just set my setting as you have indicated but, 

I am getting "no item to display" after pressing the "submit and duplicate" button.

@miss_haley 

Can you please confirm: is the OnSuccess property of your Form set to this code?

 

NewForm(Form1);

 

Usually, this error happens when there the Form is in Edit Mode and there is no item to Display.  Did you set your form to Edit Mode?

 

What does the DefaultMode property of the Form say?  Please try setting it to this code

 

FormMode.New

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

@mdevaney 

Hi, I found the issue. I changed the Item Property of my form to

Default(SP_List.

Also I had the wrong chain of operation. I had my Onselect Property

(SubmitFrom(NewForm1)); Set(varDup,true)

I changed it to : 

Set(varDup,true); (SubmitFrom(NewForm1))

After applying this it is working as expected.

 

Thank you again for helping me! 

 

However this is making the app very slow... or is this just in the preview environment?

@miss_haley 
The code you have used will not have any impact on performance.  Perhaps PowerApps is just slow at this moment and will be faster in a few hours.

 

Please Accept As Solution for my post and your own post.  You can mark more than 1 answer as the Solution.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Retain-form-data-with-lastsubmit-combobox-fo...  

@mdevaney 

Hi, it seems that the buttons have some bugs or issue.

 

The "submit" only button doesn't let me select it anymore.

 

The "submit and duplicate" button doesn't work on first loading of app. 

 

I double check to see if I changed any setting I have not. 

Hi @miss_haley ,

 

I have used the same formula, in my application it works fine.

 

it maybe the PowerApps issue, which is running slow or maybe the internet connectivity.

 

Thanks for the Solution

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,444)