cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PowerApps20201
Frequent Visitor

Add static value to a dynamic dropdown values

Hi All,

 

I want to add a static value in the dynamic dropdown list.

By using the following formula I am taking the distinct values in the dropdown box

Distinct(DeviceOrders, 'Product Status')

I want to add a static value i.e. "All" in the dynamic dropdown list. I try to used collection to add static value but it gives me an error.

 

Please help me...!

 

Thank you

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @PowerApps20201 ,

You need a Collection

ClearCollect(
   colMyDD,
   {Result:"All"}
);
Collect(
   colMyDD,
   Distinct(
      DeviceOrders, 
      'Product Status'
   )
)

then the Items of the drop-down will be colMyDD (or whatever you want to call it)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

8 REPLIES 8
WarrenBelz
Super User
Super User

Hi @PowerApps20201 ,

You need a Collection

ClearCollect(
   colMyDD,
   {Result:"All"}
);
Collect(
   colMyDD,
   Distinct(
      DeviceOrders, 
      'Product Status'
   )
)

then the Items of the drop-down will be colMyDD (or whatever you want to call it)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz ,

Thank you for your response.

I tried to implement the solution given by you on "OnVisible" property of Screen as follows:

 

PowerApps20201_1-1604401291140.png

 

But got an error as below:

 

PowerApps20201_0-1604401110360.png

 

Thank you

Hi @PowerApps20201 ,

The syntax is correct providing your Distinct filter is - see test example below

colDD.png

What type of field is 'Product Status' ?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz ,

I am using 'Product Status'  as "Option Set" DataType.

Hi @PowerApps20201 ,

Try this

ClearCollect(
   colMyDD,
   {Result:"All"}
);
Collect(
   colMyDD,
   Distinct(
      AddColumns(
         DeviceOrders,
         "ProdStatus",
         'Product Status'.Value
      ),		 
      ProdStatus
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @WarrenBelz,

I tried to implement the solution given by you as follows:

 

PowerApps20201_0-1604463932819.png

 

But got an error

PowerApps20201_1-1604463992818.png

 

How can I resolve the above error?
 
Thank you
WarrenBelz
Super User
Super User

@PowerApps20201 ,

Re-posting the same question after 40 minutes may not be helpful - I am not constantly online and anyone looking at this needs to know that you are dealing with a CDS Option Set.

I am a SharePoint user and tested this on a Choice field (similar structure) and it produced the desired result (hence I posted the suggestion).

Here is a good document on Option sets - you may find some assistance there.

 

Hi @WarrenBelz,

Thank you for your response.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,188)