How to Get Gallery Item By ID in Power Apps

This Power Apps Tutorial will teach us how to work with how to get gallery item by ID in Power Apps.

While working with the Power Apps canvas app, we got a requirement to get the gallery item by their respective ID.

Here, we will see how to get an item by their ID within the Power Apps gallery.

Also, Read: Power Apps Set ThisItem Value [With Real Examples]

Power Apps Get Gallery Item By ID

This section will show how to get an item via id within the Power Apps gallery. That means the Power Apps gallery will display only those items whose ID matches the given ID.

To work with the scenario, the following steps are:

  • We have prepared a gallery by using a certain SharePoint list named Content Scheduler list that displays the items’ ID, title, draft date, publish date, type, etc. as shown below:
Power Apps get gallery item by id
Power Apps get gallery item by id
  • From the above Power Apps gallery, we want to display only that item whose ID is equal to 5. To get the gallery item, insert the below expression on the above gallery’s Items property.
Items = Filter('Content Scheduler', ID = 5)

Where ‘Content Scheduler’ is the name of the SharePoint data source, and ID is the name of the SharePoint list column.

Power Apps get a gallery item by ID
Power Apps get a gallery item by ID

This is how to get a gallery item by ID within Power Apps.

Check out: Power Apps Gallery Patch [With Various Examples]

See also  How to Apply Conditional Formatting in Power BI Bar Chart?

Power Apps get gallery items via id using Or condition

In this section, we’ll look at how to retrieve gallery items by ID using the OR condition. That means, from the above Power Apps gallery retrieve the items whose IDs are equal to 7 or 3.

To get the gallery items, the following steps are:

  • On the above Power Apps gallery, insert the below expression on the Items property of the gallery.
Items = Filter(
    'Content Scheduler',
    ID = 7 Or ID = 3
)

Once the formula is applied, we can see the Power Apps gallery will display only those items whose ID matches to 3 or 7.

Power Apps get a gallery item by ID using OR condition
Power Apps get a gallery item by ID using OR condition

This is how to get a gallery item by ID using OR condition within the Power Apps.

Read: Power Apps Checkbox control within Gallery

Power Apps get gallery item via id based on dropdown

In this section, we will see how to get gallery items via ID based on a dropdown control within the Power Apps. That means when the user selects any ID from the dropdown control the respective item will be displayed on the Power Apps gallery.

To work with this scenario, we are going to use the above Power Apps gallery and the following steps are:

  • On the above Power Apps screen, add a dropdown control and place it beside the gallery.
  • Click on Insert > Input > Dropdown > Select.
  • Insert the below expression on the Power Apps dropdown control’s Items property to display all the item’s ID.
Items = 'Content Scheduler'.ID
Power Apps get a gallery item by ID based on dropdown control
Power Apps get a gallery item by ID based on dropdown control
  • To get the gallery item based on the dropdown control inside the Power Apps, insert the below expression on the gallery’s Items property.
Items = Filter(
    'Content Scheduler',
    ID = ItemID_dd.Selected.ID
)

Where ItemID_dd is the name of the Power Apps dropdown control.

Power Apps gallery get item by ID based on Dropdown
Power Apps gallery get item by ID based on Dropdown

Let’s preview the app and select any ID from the dropdown control. We can see the respective item will be displayed in the Power Apps gallery.

Get gallery item by ID using Power Apps dropdown
Get gallery item by ID using Power Apps dropdown

This is how to get the gallery item by ID using a Power Apps dropdown control.

See also  Power Automate startsWith() Function [With Examples]

Additionally, you may like some more Power Apps Tutorials:

Conclusion

From this Power Apps Tutorial, we learned how to get the gallery item by ID based on different scenarios such as:

  • Get gallery an item by ID in Power Apps
  • Power Apps get gallery items via id using Or condition
  • Power Apps get gallery item via id based on dropdown
>