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 / Problem with variables...
Power Apps
Answered

Problem with variables - not setting right away

(0) ShareShare
ReportReport
Posted on by 27

Hello!

 

I have a canvas app with 2 screens. Screen 1 is dashboard with gallery, and Screen 2 shows a datatable based on the item that was clicked on Screen 1. I have around 5 datatables. On Screen 2, I have a function that should update the selected row from the datatable (which is connected to sharepoint lists). I do this by passing the tableName.Selected.ColumnName to a variable which I set on the OnVisible property of Screen 2. I used a condition that if the table is visible, then set that value to the variable. This variable is then passed to a flow that will update my sharepoint list. Now, this works when I'm on Edit mode in the app. I don't encounter any errors.

 

My problem is, when I "Play" the app, or when it is initially loaded from the Apps list, I encounter an error that the flow has failed. "The method 'Run' has an invalid value for parameter 'number'. Upon investigation, I realize that this is caused by the variable that I'm passing to the flow.  And when I did more testing, the app works fine when I try to visit or click each item on the gallery in Screen 1 then showing all the different tables first before I click the update function. 

I think that the variables are not setting right away on the initial load that it's sending an empty value to the flow? Has anyone encountered the same? I would appreciate any help. Thanks.

Categories:
I have the same question (0)
  • MVP-Phipps Profile Picture
    3,521 Super User 2024 Season 1 on at

    Have you attempted a delay on the display mode of the update button to give the variable time to save? You could achieve this through timer control. Literally a matter of a second sometimes...

  • Verified answer
    medjasu Profile Picture
    27 on at

    Hi @phipps0218 !

     

    Thank you for your help. It gave me an idea to try other solutions. 


    It lead me to find out it was a problem with setting the variable on the OnVisible property. It would only fire on the second time I visit the screen.

     

    I had to go with the solution here, quite similar to what you suggested. And now it works! 🙂

    https://powerusers.microsoft.com/t5/Building-Power-Apps/Onvisible-Not-Firing/td-p/236952

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!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 742

#2
Valantis Profile Picture

Valantis 474

#3
Haque Profile Picture

Haque 358

Last 30 days Overall leaderboard