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 / unable to set a global...
Power Apps
Answered

unable to set a global variable on the screen OnVisible() property

(0) ShareShare
ReportReport
Posted on by 2,082 Season of Giving Solutions 2025

on the app onStart i am setting those variables based on the id paramters:-

 

Set(varNavigationID,Value(Param("id")));

 

and then on the screen onvisible i am setting a global variable, as follow:=

 

 

Set(varBCID,Blank());
If(IsBlank(varBCID),If(!IsBlank(varNavigationID),Set(varBCID,varNavigationID),Set(varBCID,varBCID)),Blank());

 

but this is raising these errors:-

 

johnjohnPter_0-1702291490139.png

 

johnjohnPter_1-1702291511404.png

 

any advice how to fix these issues?

thanks

 

 

 

 

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

    @johnjohnPter ,

    Try setting to zero instead of blank - it is a numeric variable.

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • johnjohnPter Profile Picture
    2,082 Season of Giving Solutions 2025 on at

    @WarrenBelz ok set the formula as follow:-

     

     

    Set(varBCID,0);
    If(IsBlank(varBCID),If(!IsBlank(varNavigationID),Set(varBCID,varNavigationID),Set(varBCID,varBCID)),0);

     

     

    but still same error, the error will happen when i access the published app or when i close and reopen the app on design mode.. not sure what is wrong ?

  • Verified answer
    Chris-D Profile Picture
    1,246 on at

    @johnjohnPter , why are you setting varBCID to Blank() and then immediately checking if it's blank? I think your code needs tweaking here? 

     

     

     

    // Set to blank
    Set(varBCID,Blank());
    
    If(
     // ALWAYS TRUE
     IsBlank(varBCID),
    
     // This always happens
     If(
     !IsBlank(varNavigationID),
     Set(varBCID,varNavigationID),
    
     // Set variable to itself?? Completely pointless.
     Set(varBCID,varBCID)
     ),
    
     // Never happens, but Blank() is a return code in this case, you're not setting anything
     Blank()
    );

     

     

     

    Why not just:

     

     

    If( !IsBlank(varNavigationID), Set(varBCID,varNavigationID));

     

     

     

    Am I missing something? 

  • WarrenBelz Profile Picture
    156,566 Most Valuable Professional on at

    @johnjohnPter ,

    The error you are getting is that you have a Variable that you are setting to another data type somewhere else - this is either varBCID or varNavigationID, so you need to look for all instances of these being set to find the offending item.

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 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard