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 / How to reset global va...
Power Apps
Answered

How to reset global variable selected from gallery item

(0) ShareShare
ReportReport
Posted on by 67

I have a today's work gallery that display a list of work orders and once the user selects a particular one it will sets global variables that are used throughout the app. I know the global variable changes once the user selects another work order but sometimes it is not the case (1 out of 5 would cache). It will cache to the previous variable.  how do i resolve that? 

 

I tried to reset the gallery.selected or all item on the onvisible of the screen but that doesn't work because RESET functions requires a control. 

Categories:
I have the same question (0)
  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    You could reset the variables in the OnVisible of the screen

  • yichingjc Profile Picture
    67 on at

    @BrianS  Do I reset it to blank ""?

  • eka24 Profile Picture
    20,925 on at

    Show the formula for the variable in the Gallery.

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

  • yichingjc Profile Picture
    67 on at

    @eka24 
    Set(workOrder, LookUp('Work Orders', 'Work Order Number'=ThisItem.'Work Order'.'Work Order Number'));

    Set(workOrderType, workOrder.'Work Order Type');

    Set(workOrderAccount, LookUp(Accounts,'Account Name'=workOrder.'Service Account Name'));

    Set(floorPlan, workOrder.Floorplan.Name);

    Set(sqFoot, workOrder.Floorplan.'Sq Ft');

    Set(workOrderGuid, GUID(ThisItem.'Work Order'.'WO Number'));

    Set(jobProfile, workOrder.rr_LinkedJobProfile);

    Set(brbGuid,ThisItem.'Bookable Resource Booking');

  • BrianS Profile Picture
    2,407 Super User 2024 Season 1 on at

    Any variables that are text can be set to blank like this: Set(varName,""), Numbers can be set to 0, Dates can't be set to a null, but can be set to an obviously erroneous date.

  • eka24 Profile Picture
    20,925 on at

    So to confirm you have 8 variables on a single button inside the Gallery?

    If so you can replace that with:

    Set(myItems, Gallery1.Selected)

     

    You can then make Use of all the Column names as variables in other screen such as; myItems.OrderNumber

    ------------

    If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

     

     

  • Verified answer
    yichingjc Profile Picture
    67 on at

    @eka24  I ended up using set(workOrder, Blank()) to clear the global variables. thanks

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 325 Most Valuable Professional

#2
11manish Profile Picture

11manish 165

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 88 Super User 2026 Season 1

Last 30 days Overall leaderboard