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
Impactful Individual
Impactful Individual

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
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.

Top Kudoed Authors
Users online (3,342)