cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
EYOST
Level: Powered On

ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

Hi all,

 

My previous questions couldn't get the answer I want, so I'm wondering if there is any alternatives.

What I can think of
1) Set the default value to "ALL selections" (which ALL is not exist in the database table record).

OR

2) Add a "ALL" selection into the list of combobox.

 

Appreciate for your sharing.

Thanks in advanced!

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
PavanKumar
Level 8

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

Hi,

Could you elaborate how are you showing values in the Gallery?

 

If you are not already doing it. here are the steps to do so.

 

1. Within your Canvas App, Go to View --> Datasources and add your datasource (from where you want to get and who data)

2. In your Screen Add a Combobox (In the menu go to Insert --> Controls --> combobox)

3. Select the screen and go to Onvisible Property and write formulae ClearCollect(colData,{Id:"ALL"},Datasource) (Replace Datasource with your relevant datasource/datatable name. Id column replace with display text column of your datasource)

4. In the combobox properties go to Items and write colData. In Display Fields property --> (mention the column which you want to show in combobox)

5. Insert a Blank Horizantal Gallery in your screen (Insert --> Gallery --> Blank Horizantal) in the Items property mention the formulae
If(combobox1.selected.id = "ALL" , colData,combobox1.selecteditems).
//Above formulae means if user selects ALL in the combobox it shows all data which you got from datasource, otherwise it only shows record which users has selected.

In Gallery add required columns which you want to show.



if this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

View solution in original post

Highlighted
EYOST
Level: Powered On

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

@PavanKumar 
Thanks alot on your steps in details below!

I tried again by following your steps, it is able to show "ALL" and other values in the combobox now!

Except No.5, If(combobox1.selected.id = "ALL" , colData,combobox1.selecteditems)

For the reference to anyone who may need it in Filter() and Distinct():
- I changed to If(combobox1.selected.id = "ALL" , true,id in combobox1.selecteditems.id) because I use it inside Filter():
Filter(TableName,If(combobox1.selected.id = "ALL" , true, id in combobox1.selecteditems.id))
- In order to make the value distinct, Item Property = Distinct(colData,FN1)so the formula have to change to :
Filter(TableName,If(combobox1.selected.Result= "ALL" , true, id in combobox1.selecteditems.Result))

Actually I wish to use Distinct but don't wish to use ".Result" because it is only one value which so inconvenient. Appreciate if you can advise on this.

 

Thanks again for your answer!

View solution in original post

7 REPLIES 7
PavanKumar
Level 8

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

Hi,

 

On visible of screen load your data which you want to show in Combobox in a collection example

ClearCollect(colValues,{organisationvalue:"ALL"},organisation).//This adds both organisation datasource values and also ALL in the collection so that you can show that in items property of combobox.

 

 (lets say your datasource is organisation in which organisationvalue field you want to display in combobox, then select organisationvalue field in display fields property of combobox)

 

 

if this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

EYOST
Level: Powered On

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

@PavanKumar Firstly, thanks for helping on my question!

Do you mean the steps below?

1) Screen.OnVisible = ClearCollect(NewCollectionName,{ColumnNameInTheCollection:"ALL"},FromDataSourceTableName)

2) ComboBox.Item = NewCollectionName
    ComboBox.DisplayField= ColumnNameInTheCollection
If yes, the combobox list is empty after clicked, not sure where goes wrong..

Did I miss some steps?

EYOST
Level: Powered On

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

@PavanKumar 
I know why the list is empty, it needs to be switch screen to this screen then only the collection take effect due to the formula is in this screen.

However, it only show ALL without other value(as per image attached.)
image.png

May I know whether possible to show the all fields and also ALL?

Thank you

 

PavanKumar
Level 8

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

Hi,

 

On visible property of the screen you have added values to your collection right using Clearcollect.

 

Once check File-->collections--> your collection name (what records its showing). Those records populate in your combobox.

 

If you need to trigger the on visible property of the screen. move to another screen and come back to this screen.

 

If this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

EYOST
Level: Powered On

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

@PavanKumar Pardon that I don't really understand.

Not sure what I have missed, how should I do in order to make the list (as printscreen above) to show all values and "ALL" too?

Appreciate for your explaination, looks forward for your reply.

Thank you!

PavanKumar
Level 8

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

Hi,

Could you elaborate how are you showing values in the Gallery?

 

If you are not already doing it. here are the steps to do so.

 

1. Within your Canvas App, Go to View --> Datasources and add your datasource (from where you want to get and who data)

2. In your Screen Add a Combobox (In the menu go to Insert --> Controls --> combobox)

3. Select the screen and go to Onvisible Property and write formulae ClearCollect(colData,{Id:"ALL"},Datasource) (Replace Datasource with your relevant datasource/datatable name. Id column replace with display text column of your datasource)

4. In the combobox properties go to Items and write colData. In Display Fields property --> (mention the column which you want to show in combobox)

5. Insert a Blank Horizantal Gallery in your screen (Insert --> Gallery --> Blank Horizantal) in the Items property mention the formulae
If(combobox1.selected.id = "ALL" , colData,combobox1.selecteditems).
//Above formulae means if user selects ALL in the combobox it shows all data which you got from datasource, otherwise it only shows record which users has selected.

In Gallery add required columns which you want to show.



if this answers your question mark it as verified and give thumbs up

Regards,

Pavan Kumar Garlapati

View solution in original post

Highlighted
EYOST
Level: Powered On

Re: ComboBox Set ALL Values as default selected item OR Add a selection for ALL Values

@PavanKumar 
Thanks alot on your steps in details below!

I tried again by following your steps, it is able to show "ALL" and other values in the combobox now!

Except No.5, If(combobox1.selected.id = "ALL" , colData,combobox1.selecteditems)

For the reference to anyone who may need it in Filter() and Distinct():
- I changed to If(combobox1.selected.id = "ALL" , true,id in combobox1.selecteditems.id) because I use it inside Filter():
Filter(TableName,If(combobox1.selected.id = "ALL" , true, id in combobox1.selecteditems.id))
- In order to make the value distinct, Item Property = Distinct(colData,FN1)so the formula have to change to :
Filter(TableName,If(combobox1.selected.Result= "ALL" , true, id in combobox1.selecteditems.Result))

Actually I wish to use Distinct but don't wish to use ".Result" because it is only one value which so inconvenient. Appreciate if you can advise on this.

 

Thanks again for your answer!

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,688)