cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
misc
Resolver II
Resolver II

Combobox defaultselecteditems for view/edit forms not showing previously entered data

I am creating an app with the data source as a SharePoint list. The majority of columns are Single Line of Text, but on quite a few data cards on the app I have amended the text input to a combobox to allow the selection of one or more selected responses. The Items property of these comboboxes are therefore along the lines of this one:

 

 

["N/A", "Fuel gases", "Oxygen enriching gases", "Oxygen depletion gases", "Toxic and corrosive gases", "Compressed air"]

 

 

The app works in that I can submit a new form and edit a previous record absolutely fine, however, when a user is viewing or editing a previously submitted record the combobox doesn't show the data from that column (and so it needs to be resubmitted every time).

 

I'm aware I need to pull the previous data in as a Record so I can't just use Parent.Default as I do with normal dropdowns or text inputs, but I can't work out how to do this.

 

Screenshot below. Blue is a normal dropdown input which pulls the data from the record, Red is the combobox which reverts to blank 

lab01error.png

  Your help is appreciated!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@misc 

No need for all of that...

In your Update Property of the DataCard, put this formula:

   Concat(yourCombobox.SelectedItems, Value & ";")

 

Then in the DefaultSeletedItems poprety of the Combobox, put the following formula:

   RenameColumns(Filter(Split(ThisItem.yourColumnName, ";"), !IsBlank(Result)), "Result", "Value")

 

This should give you what you are looking for.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

7 REPLIES 7
RandyHayes
Super User III
Super User III

@misc 

The EditForm already accommodates what you are doing within the Edit Fields for the form.

 

If you have already unlocked your datacard that you want to be a dropdown (and I recommend a dropdown and NOT a combobox for what you need), then go into the Edit Fields and remove that field.  Then add it back in.  Then in the same place choose to change the control type.  One of your choices will be Allowed Values.  Choose that option.

 

 

Now, your datacard will have the dropdown in it already wired to do everything you need (edit, view, new), plus you will have a new property on the DataCard called Allowed values.  Simply replace the formula that is in that property with:

["N/A", "Fuel gases", "Oxygen enriching gases", "Oxygen depletion gases", "Toxic and corrosive gases", "Compressed air"]

 

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Sorry, perhaps I wasn't clear. I need the combobox because I need users to be able to select multiple options.

 

The problem is as follows:

1) A user completes a new form, this submits correctly and is added to the sharepoint list

2) The user comes back to the app and wants to EDIT or VIEW their previously submitted record. They can see all their previously submitted responses, except those in the datacards which use comboboxes.

 

I cannot set the combobox 'Default' or 'DefaultSelectedItems' to 'Parent.Default' - like I have with the other dropdowns, as this does not work with comboboxes (as far as I can tell).

 

This means that whenever a user comes to VIEW or EDIT their previous record, they have to recomplete all of those cards in order to submit the form again. 

 

I only included my Items property to show the combobox Items were manually added and not pulled from the data soure.

RandyHayes
Super User III
Super User III

@misc 

The questions then are these...

1) You mention the underlying column is a Text Column.  Is that the case are am I misunderstanding that you also changed this column type in your list to a multiple-choices column?

2) If it is a Text column, then how are you storing the multiple selections in the text column (in other words, what is the Update property of your Datacard)?

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Yes, the underlying column is a Text column as I find they're usually the most versatile to change (eg. those that needed standard dropdowns I was able to just change to 'Allowed Values' like you initially suggested)

 

I actually only just noticed it's only writing one of the chosen options back to the data source, my workaround for this would probably be to put in a hidden Concat text label and use that as the Update property. Although this works to update the list properly, I still can't work out what I would use as the default property of the combobox so it shows that data when reviewing/updating the form.

 

 

RandyHayes
Super User III
Super User III

@misc 

No need for all of that...

In your Update Property of the DataCard, put this formula:

   Concat(yourCombobox.SelectedItems, Value & ";")

 

Then in the DefaultSeletedItems poprety of the Combobox, put the following formula:

   RenameColumns(Filter(Split(ThisItem.yourColumnName, ";"), !IsBlank(Result)), "Result", "Value")

 

This should give you what you are looking for.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

misc
Resolver II
Resolver II

 Randy back to the rescue, thank you, it works!

RandyHayes
Super User III
Super User III

@misc 

So glad to hear!!  Glad it helped.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (45,943)