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

Re: combobox : default to last saved record

1- User Selects the Surname from Combobox. (searchfield = NOM)

  • The combobox pulls data from an excel table with 4 columns: SURNAME, FIRSTNAME, EMAIL, YEAR
  • The combobox choice populates 3 other text labels: 1) First Name/Surname, 2) Year and 3) Email

If(ShowSavedValue,ThisItem.Student1,Concat(S1ComboConcat.SelectedItems, NOM & " " & PRENOM, ","))

 

3- user enters dates (debut, fin)

4 on submit ClearCollect for all the items in this gallery and Patch function to create a new record

5 Users will email this collection to student 

( Datatable not for users, just to confirm that the records are being successfully updated on the excel file)!

Let me know if you need any further information and thanks again for your continued patience

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

Sorry I can't quite understand the issue here. so before patching the items, everything is correct, right? the SureNameTextBox = ComboBox.Selected, and the Patch insert the data correctly in your list.

are you saying that after the Patch, the value of the combo box changes?

Do you reset all your controls after Patching data?

What do you expect to see in the Surname textbox, and the combobox after patching the data?

Englishweb
Level 8

Re: combobox : default to last saved record

Hello @Edwin-Abdalian 

When I select the name from the combo list it updates the text box immediately.  No Problem!

When I click save the Patch inserts the data correctly into the list. No Problem!

After the Patch, the value of the combo box shows a name, it's not the last on the list, nor the first on the list, nor the one selected and it doesn't correspond to the name in the text box . the user can manually delete the name in the combo search box but then the value is blank and clicking save sends a blank value to the list (excel).

 

In the save button I have ClearCollect plus Patch (SUMMARYDATATABLE,ThisItem,{all the fields in the gallery}) ;UpdateContext({LetsEdit: false }) ;Set(ShowSavedValue, true);

After patching the Surname textbox, and the combobox SHOULD be the same name.

 

The properties of the combo box are:

OnChange Set(ShowSavedValue, false)

DisplayFields, ["NOM,"PRENOM"], SearchFields, ["NOM"] Items, ALLSTUDENTSTABLE

SelectMultiple, false   Default,      DefaultSelectedItems,         Reset, false  IsSearchable, true MultiValueDelimiter ","

Hope this help!

Thanks for your help

 

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

now I got it (I think so lol )

another user had the same complain. so you still want to show the last value that user saved in combobox , but it changes it automatically.

just try this quickly

1- OnSelect of the button and after patch:  Refresh('SharePointDataSource'); Reset(Combobox); Set(varLastRecord,Last('SharePointDataSource')); 

2- on DefaultSelectedItems of combobox: varLastRecord.TheColumnName.Value

    

the red part might cause a little performace issue, try also without it and see if it works.

Englishweb
Level 8

Re: combobox : default to last saved record

Hello @Edwin-Abdalian 

Unfortunately it doesn't work, the   .Value   wasn't accepted for DefaultSelectedItems .

It must be a bug. Thanks anyway for all your hard work.

Hope there is a solution soon!

 

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

don't give up yet, I'll create a screen similar to yours and try it today.

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

I added a textbox and a combobox and a button in a gallery and used Patch to insert the data. the value of the combobox doesn't change after patching. I was not able to replicate the issue. I have nothing in the Default nor DefaultSelectedItems.

@mdevaney are you aware of an issue, where the value of the combobox changes to something else after patching the record to datasource?patch.PNG

 

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

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

I was able to replicate the issue

View solution in original post

Edwin-Abdalian
Level 10

Re: combobox : default to last saved record

@Englishweb  I replicated the issue and was able to fix it.

at the end of your patch:

Reset(ComboBox2_1); ClearCollect(colLastChoice, {Value: Last('Master Test').myChoice.Value})

DefaultSelectedItems of your combobox: colLastChoice.Value

Englishweb
Level 8

Re: combobox : default to last saved record

Hello @ Edwin-Abdalian

A couple of questions (please forgive me if they are obvious)

('Master Test') Is the datasource which I'm patching the data to? (The combobox is being populated  from a different table)

Patch button won’t accept  .Value  What am I doing wrong?

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,511)