Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Having trouble with a Context Variable

Posted on by 359

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:
  • Verified answer
    bobgodin Profile Picture
    bobgodin 359 on at
    Re: Having trouble with a Context Variable

    well I have solved the problem by changing:

    UpdateContext({ varWRT: !varWRT })

    to:

    UpdateContext({varWRT: !varWRT})
  • bobgodin Profile Picture
    bobgodin 359 on at
    Re: Having trouble with a Context Variable

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

  • CU-18081211-6 Profile Picture
    CU-18081211-6 9,261 on at
    Re: Having trouble with a Context Variable

    @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 ?  

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,532

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,050

Leaderboard