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 / Having trouble with a ...
Power Apps
Answered

Having trouble with a Context Variable

(0) ShareShare
ReportReport
Posted on by 380

I have an app whose datasource is a Sharepoint list and i have a field that can have 1 of 2 possible values. It is a text field in Sharepoint called "triptype" - the values can be either "WORKRELATEDTRAVEL" or 'FIELDTRIP"

 

I have a Gallery where the user selects the trip record for editing by clicking a button - the OnSelect property is:

If(
 Gallery5.Selected.triptype.Value = "WORKRELATEDTRAVEL",
 (Navigate(
 NEWTRIPMANAGER,
 Fade,
 {
 varWRT: true,
 varFROMGALLERY5: true
 }
 )),
 Navigate(
 NEWTRIPMANAGER,
 Fade,
 {
 varWRT: false,
 varFROMGALLERY5: true
 }
 )
)

In the NEWTRIPMANAGER screen I have a button which (sometimes) toggles between displaying the text WRT and FIELD - based on the value the user will have more or less fields to complete before submitting the trip. The OnSelect of the button is:

UpdateContext({ varWRT: !varWRT })
\\and the Text proerty is:
If(varWRT=true,"WRT","FIELD")

it seems to work once changing from one value to the other but then stops changing.......it used to work in my app but something must have changed and it no longer works..

Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @bobgodin ,

    There is no reason why the code should not work.

    If(varWRT,"WRT","FIELD")

     Is your OnSelect code from the button more complex ? A IF clause can cause this ?  

  • bobgodin Profile Picture
    380 on at

    @gabibalaban Yes my OnSelect says If triptype=WORKRELATEDTRAVEL set varWRT,true else false - see above code

  • Verified answer
    bobgodin Profile Picture
    380 on at

    well I have solved the problem by changing:

    UpdateContext({ varWRT: !varWRT })

    to:

    UpdateContext({varWRT: !varWRT})

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 542 Most Valuable Professional

#2
Haque Profile Picture

Haque 206

#3
Kalathiya Profile Picture

Kalathiya 201 Super User 2026 Season 1

Last 30 days Overall leaderboard