cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Englishweb
Post Patron
Post Patron

combobox : default to last saved record

Hello

How do I keep the last saved selected item visible in the combo searchbox after saving the item? (How to avoid losing the last data entry by accidently saving an empty combobox )!

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

update---------------------------

I was able to replicate the issue

View solution in original post

20 REPLIES 20
Edwin-Abdalian
Solution Supplier
Solution Supplier

Assuming that your form is in New mode. use YourForm.LastSubmit.Value on the OnSuccess of your form and store the value in a variable, like Set(glbComboValue,YourForm.LastSubmit.Value). then set the Default property of your combobox to this variable

v-monli-msft
Community Support
Community Support

Hi @Englishweb ,

 

If the purpose of this requirement is to avoid empty saving for the combo box field, then you could achieve this by set below formula in the submit button:

SubmitForm(Form1);ClearCollect(C1,ComboBox1.SelectedItems)

Then set below formula in the Default property of combox box data card:

C1

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-monli-msft @Edwin-Abdalian 

The Combobox is in a Gallery, not a form, could you tell me the settings for this please?

And thanks again for all your help!

Here is a visual of the Gallery and corresponding datatable (and the problematic combobox)!

The Textlabels are working perfectly, as is the patch to the datatable. The Combobox reverts to another surname, not the last saved one, which is confusing. 

I am trying to get the combobox default to be the same as the text label....

Comboproblem2.PNG

on the Select of your button, get the Last record that was created in your list.

Refresh('Master Test');
Set(varLastRecord,Last('Master Test'));

 

Then set the Default property of your combobox to varLastRecord.myChoice.Value

**Please replace the names with your controls and columns names

Thanks@Edwin-Abdalian 

I've updated the OnSelect: Refresh(SUMMARYDATATABLE);Set(varLastRecord,Last(SUMMARYDATATABLE));

 

For the Default properties on the combo box I tried  varLastRecord.Student1.Value

but .Value gives an error

Any ideas??

Thanks!

Could you use Alt+Button to populate the variable with a value first. it might help.

I don't see an error on my side and it's happy with the Value. but I remember having issues with the Last() function and at some point I considered using the First() function but sort it descending

Set(varLastRecord,First(Sort(MyDataSource,ID,SortOrder.Descending)))

 

Hello@Edwin-Abdalian 

Thank you for your continued patience.

I think there is maybe a confusion, I probably am not explaining myself clearly.  I want the combobox to show the same name as in the data table entry, not the last record in the table. Is this possible? I've been trying to resolve this for days!

Comboproblem2.PNG

Could you please tell me the sequence of the actions that users take to complete that form.

1- User enters the First Name, Surname (it's a textInput control)

2- user enters dates (debut, fin)

3- What does the user do with the comboBox? what is behind the combobox? is it a choice field? a Person or a lookup?

4- user presses Submit (you use Patch() function to create a new record

5- users sees the record that was created in a data able

6- Data table shows the name

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza Winner Announcement

Please join us on Wednesday, July 21st at 8a PDT. We will be announcing the Winners of the Demo Extravaganza!

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

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.

Top Solution Authors
Top Kudoed Authors
Users online (2,293)