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
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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