web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Can I use context vari...
Power Apps
Unanswered

Can I use context variable to set a column to display in gallery?

(0) ShareShare
ReportReport
Posted on by 235

Hi

I have a SP list with two sets of very similar data - HalalCertBody, HalalEnd, HalalStatus / KosherCertBody, KosherEnd, KosherStatus.

I have a gallery which currently displays labels for Certifying Body, End Date, Status

I have created 2 buttons: Halal and Kosher

I want to use context variables so that if the Halal button is pressed the gallery displays HalalCertBody, HalalEnd, HalalStatus, or if the Kosher button is pressed the gallery displays KosherCertBody, KosherEnd, KosherStatus.

 

How do I update context to the name of the column, and then how do I get the label in the gallery to display based on the context variable? This is what I've tried for the Halal button and the Certifying Body column...

 

GraemeNZ_0-1637725318966.png

GraemeNZ_1-1637725548096.png

Looking forward to your replies,

GraemeNZ

 

Categories:
  • WarrenBelz Profile Picture
    156,538 Most Valuable Professional on at

    Hi @GraemeNZ ,

    Try this- note I have assumed your field name here (I assume the field exists)

    Filter(
     SPList,
     Switch(
     CertBody,
     "HalelCertBody",
     'Certifying Body' = "HalelEnd || 'Certifying Body' = HalelStatus",
     "KosherCertBody",
     'Certifying Body' = "KosherEnd || 'Certifying Body' = KosherStatus"
     )
     )
    )

     

    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.

    Visit my blog Practical Power Apps

  • GraemeNZ Profile Picture
    235 on at

    Hi - I wasn't sure what you meant above, but thanks for providing an answer.

    I decided to go for the simpler approach and I duplicated the screen. One for Halal, one for Kosher, and added a button for each to navigate to the other one. Since I duplicated the screen after it was set up, from the user perspective it just looks like the content changes (which is what I was after)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard