cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
IntraAdmin
Helper I
Helper I

ComboBox to filter Gallery by ID

I have a Gallery that I want users to be able to search by ID.  I created a collection to get the ID and store it in a combo box plus added the value "All".  With the function I have, I am only seeing "All" in the Value and the ID in Result within the collection.  Therefore, "All" is the only value displaying in the combo box.  I have tried using Value in place of Result to see if it will put the ID in the Value column, as well. How can I get the ID in the combo box for search purposes?  Thank you in advance for your assistance.

 

 

 

ClearCollect(
colCID,
{Value:"All"},
{Result:('AIMS Q & A'.ID)}
);

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

@IntraAdmin ,

That is strange as any list will sort on ID, but if you have less than 2,000 items, forget about the sort. I have now tested this and you need

ClearCollect(
   colCID,
   {txtID: "All"},
   AddColumns(
      'AIMS Q & A',
      "txtID",
      Text(ID)
   )
)

Note that the ID will be Text in the drop-down (it has to be as that is all it will accept) and you will need to use 

Value(ddName.Selected.txtID)

when finding the record

Your Drop-down Items will be

colCID.txtID

 

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

14 REPLIES 14
PG_WorXz10
Resident Rockstar
Resident Rockstar

@IntraAdmin Would you please try 

ClearCollect (colCID, {Value:"All"}); ForAll('AIMS Q & A' As Master

Collect(colCID,{Value: Master.ID}));

IntraAdmin
Helper I
Helper I

@PG_WorXz10  I tried your function but I am receiving an error on the ForAll function As is not permitted in this context.

 

PG_WorXz10
Resident Rockstar
Resident Rockstar

Would you please explain if 'AIMS Q &A' is collection or DataSource ? if it is not a collection would you please try adding the source in collection and then in ForAll use this collection ?

IntraAdmin
Helper I
Helper I

@PG_WorXz10 @RandyHayes @WarrenBelz  It's a data source.  I hate to add a whole data source to a collection.  Won't that effect performance?  I will try, though.

 

@IntraAdmin ,

Firstly try a comma after Master, but this solution is subject to Delegation numbers (it will only add the first 500-2,000 records fields from the data source). If you want the newest record, you can do this

ClearCollect (
   colCID, 
   {Value:"All"}
); 
ForAll(
   Sort(
      'AIMS Q & A' As aList,
      ID,
      Descending
   ),
   Collect(
      colCID,
      {Value: Text(aList.ID)}
   )
)

 

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.

IntraAdmin
Helper I
Helper I

@WarrenBelz @PG_WorXz10 Both are throwing an error with comma after Master in the code Priyanka shared and with the code Warren shared.  The errors on both are attached.  I am researching as we speak.  We don't see delegation as an issue as we do not expect 2,000 items. This was an emergency project that needs to be completed tomorrow and was assigned Monday late afternoon.  Hence, the urgency.

 

 

@IntraAdmin ,

Fixed on my post - problem with free-typing it needs a Text value.

 

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.

IntraAdmin
Helper I
Helper I

Thank you so much for your help @PG_WorXz10 @WarrenBelz  I have made multiple attempts to convert ID to text.  In the Sort, ID needed to be "ID"  and has been converted to text but I cannot get the VAlue in the Collect function to convert the aList.ID to text.  In that Collect function is the only error which states that the Value column in the data source expects a Text type and you're using an Error type.

ClearCollect (
   colCID, 
   {Value:"All"}
); 
ForAll(
   Sort(
      'AIMS Q & A' As aList,
      Text("ID"),
      Descending
   ),
   Collect(
      colCID,
      {Value: Text(aList.ID)}
   )
);

 

@IntraAdmin ,

You cannot have "All" which is text in the same field as the ID, which is numeric.

Why are your sorting by Text(ID) - you only need to sort by ID to get the newest records,

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,223)