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 / Variable not reinitial...
Power Apps
Unanswered

Variable not reinitializing in Power app when a different record is selected on the power bi table row

(0) ShareShare
ReportReport
Posted on by 2

Hello,

 

I have a power app and a table visual in power bi. 

The table is having data from SQL query. I pass in the row values to the power app. I am able to get those values in power app and everything is working fine. 

I wanted to set an error variable which should be initially blank for every new record that is selected in the power bi table row.I am assigning the value to variable through update context. The problem is once the error variable is set to a value it doesn't get reset to blank if I select another row in the power bi table so I expect that for each row of data in the table visual my error variable in the power app should be blank and should be set only through the validation. Any further help is appreciated. Thank you!

 

Categories:
  • pavanmanideep Profile Picture
    580 Power Up Champ - 2025 on at

    Hi,

     

    Make sure you use the correct variable type in Canvas App...

     

    Variables type Scope Description Functions that establish

    Global variablesAppSimplest to use. Holds a number, text string, Boolean, record, table, etc. that can be referenced from anywhere in the app.Set
    Context variablesScreenGreat for passing values to a screen, much like parameters to a procedure in other languages. Can be referenced from only one screen.UpdateContext
    Navigate
    CollectionsAppHolds a table that can be referenced from anywhere in the app. Allows the contents of the table to be modified rather than being set as a whole. Can be saved to the local device for later use.Collect
    ClearCollect

     

    If I have answered your question, please mark your post as Solved.

    If you like my response or got a direction forward to proceed, please give it a Thumbs Up. Appreciate your Kudos. You can accept more than one post as a solution.

     

    Blog:https://ecellorscrm.com

     

    Cheers,

    PMDY

  • anandt Profile Picture
    2 on at

    I have tried Context variable and Global variable. Nothing works.

    To give more details to the forum, please see below

     

    I have only 1 screen in my power app.

    On the OnVisible event I am setting my variable UpdateBtnDisplayVar as below:

    OnVisible: UpdateContext({UpdateBtnDisplayVar: DisplayMode.Disabled})

    I have an update button on the screen to write record to my database tables for the selected record in the table visual. Upon selecting row from the table visual, the update button should always be disabled and can get only enabled by passing through the validations.

    Due to the validations present in the app, this variable will be set as 

    UpdateContext({UpdateBtnDisplayVar: DisplayMode.Enabled})

    I then navigate to next record in the table and expect that variable should be reinitialized to its original state of UpdateBtnDisplayVar: DisplayMode.Disabled which never happens until the validation assigns it a different value

     

    Once I set the variable value, it does not change upon selecting a new row in the table visual of power bi

  • pavanmanideep Profile Picture
    580 Power Up Champ - 2025 on at

    Hi @anandt ,

     

    Try this onVisible Event

     

    UpdateContext({UpdateBtnDisplayVar: If(DataCardValue71.Value, DisplayMode.Edit, DisplayMode.Disabled)})

     

    Check this Solved: Set DisplayMode based on underlying field value - Power Platform Community (microsoft.com)

     

    Hope this helps...

     

    If I have answered your question, please mark your post as Solved.

    If you like my response or got a direction forward to proceed, please give it a Thumbs Up. Appreciate your Kudos. You can accept more than one post as a solution.

     

    Blog:https://ecellorscrm.com

     

    Cheers,

    PMDY

     

  • pavanmanideep Profile Picture
    580 Power Up Champ - 2025 on at

    Hi @anandt ,

     

    If I have answered your question, please mark your post as Solved.

    If you like my response or got a direction forward to proceed, please give it a Thumbs Up. Appreciate your Kudos. You can accept more than one post as a solution.

     

    If you were still facing any issue or challenge, please do let me know so that I can try to check for you. Happy to help you further.

     

    Blog:https://ecellorscrm.com

     

    Cheers,

    PMDY

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard