cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Englishweb
Level 8

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
Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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

I was able to replicate the issue

View solution in original post

20 REPLIES 20
Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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

Community Support Team
Community Support Team

Re: combobox : default to last saved record

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.
Englishweb
Level 8

Re: combobox : default to last saved record

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!

Englishweb
Level 8

Re: combobox : default to last saved record

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

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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

Englishweb
Level 8

Re: combobox : default to last saved record

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!

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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

 

Englishweb
Level 8

Re: combobox : default to last saved record

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

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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
thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 172 members 5,978 guests
Please welcome our newest community members: