cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
dhalpin
Helper III
Helper III

Using Dropdowns in a Gallery

Hi all,

 

I have an app where a user selects "Material" and "Process from two different dropdowns and then clicks a "Save" button which Patches Collection1.  The syntax for the dropdowns is just a list:  ["", "Wood", "Steel", "Bronze", "Aluminum", "Plastic"]

 

Below that, a Gallery displays Collection1, with "Material" and "Process" shown in Labels.  However, would like the user to be allowed to revise these 2 fields.  I have added an "Edit" icon which sets Var_EditPressed: true, and when it is pressed the user sees 2 (previously invisible) dropdowns replace the Gallery Labels.  The user would then choose from the dropdowns and click the Save button within that Gallery item, setting var_EditPressed: False. 

 

My issue is that I don't know what to put for the inline Gallery's dropdowns' DefaultSelectedItems.  Currently I have this:

If(TextInput3_2.Text="",[0],
TextInput3_2.Text="Wood",[1],
TextInput3_2.Text="Steel",[2],
TextInput3_2.Text="Bronze",[3],
TextInput3_2.Text="Aluminum",[4],
TextInput3_2.Text="Plastic",[5])

Which sort of works; I can see the list of materials, but the default is set to the index NUMBER, not string.

 

I think I'm overthinking this....

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@dhalpin 

Yes, with that formula you will just get a number (actually it's a table with a Value column that has a number in it).

 

The key to this will be from the Collection you are displaying the the Gallery.  What does that look like?

Is the Combobox needed in this scenario?  You have a limited number of options in it, so searching is probably not needed.  Do you allow multiple selections in these?  If none are really needed, you might want to consider a Dropdown instead as it will be easier to manage.

 

However, in general, I would recommend that you set the Default property of the TextInput control based on the value of the underlying column in your datasource collection.  Then have your Dropdown/combobox derive its value from the textinput.

 

Then on your save, update the underlying collection.

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

View solution in original post

4 REPLIES 4
RandyHayes
Super User III
Super User III

@dhalpin 

Yes, with that formula you will just get a number (actually it's a table with a Value column that has a number in it).

 

The key to this will be from the Collection you are displaying the the Gallery.  What does that look like?

Is the Combobox needed in this scenario?  You have a limited number of options in it, so searching is probably not needed.  Do you allow multiple selections in these?  If none are really needed, you might want to consider a Dropdown instead as it will be easier to manage.

 

However, in general, I would recommend that you set the Default property of the TextInput control based on the value of the underlying column in your datasource collection.  Then have your Dropdown/combobox derive its value from the textinput.

 

Then on your save, update the underlying collection.

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

View solution in original post

dhalpin
Helper III
Helper III

Thanks @RandyHayes.  I am using a collection to temporarily hold the line items until the whole project is specified.  Below you can see that I've entered a few components into this project ("Add Item" patches the collection which is displayed in the gallery).  Then when the Pencil/"Edit" button is pressed the Material and Process fields become drop downs to allow the user to revise the gallery item:

 

Gallery1.JPGGallery2.JPG

 

So, the gallery displays a Label with Collection.Material and Collection.Process until var_EditPressed=True, then the dropdowns are displayed.  At this point, the default should match the label (maybe the user is only updating the item description NOT material/process).  Then, when save is clicked, the gallery item & collection are updated to match the revision.

 

I am having trouble getting the Label & Dropdown to work nicely together:  the label should show what's in the collection UNLESS var_EditPressed=true, then it should be replaced by a dropdown which should ALSO reflect the collection.  Then after Save, the collection should update, therefore updating the now-visible label...  Unfortunately what's happening is when var_EditPressed=True, the dropdowns are not showing Gallery1.ThisItem.________, and whatever is chosen at this point is not written to the collection.  Instead, both fields are deleted and the corresponding labels are now blank.

 

 

 

RandyHayes
Super User III
Super User III

@dhalpin 

So sorry for delay...trying to catch up on all the posts.  Are you still experiencing issues that you need help with or have you resolved this?  Let me know if not and I will dig back in.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes
dhalpin
Helper III
Helper III

Thank you for the followup, @RandyHayes .  I have got this issue resolved, so I'll start a new thread with the unrelated question(s) for 2021!  😉  Happy New Year!

 

 

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

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 (53,063)