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 / Weird problem with a v...
Power Apps
Answered

Weird problem with a variable

(0) ShareShare
ReportReport
Posted on by 2,311 Super User 2026 Season 1

I have an app with a gallery. The gallery contains stock items and the number of them in stock. Within the gallery I added a text input box (format numeric) called QtyRqd for the user to enter how many of the item they want. Onselect of the Next Arrow within the gallery does (amongst other things), patch the 'quantity' field of the data source with ThisItem.quantity - value(QtyRqd.text) also set(var_order_qty, value(QtyRqd.text) and then navigate to the next screen. I use the variable var_order_qty on the next screen.

 

This all works perfectly when I run the app within PowerApps studio, but when I publish the app and run it outside of the studio, the value of the quantity_selected variable isn't set by the Onselect of the Next Arrow (the value is zero on the next screen). I know textinput.text is OK because the Patch function I mentioned earlier works to reduce the number in stock by the input value when the onselect happens. Also in my code below, all the other variables I set work OK on the next screen, it's only the Text Input box that fails. I also tried displaying QtyRqd.Text on the next screen instead of the variable but it's empty too.

 

It's incredibly hard to troubelshoot this because it works perfectly in Studio.

 

Anyone have an idea what could be happening?

 

Here is my Onselect of the Next Arrow in the gallery.

Set(
 var_remaining,
 Value(ThisItem.Quantity-QtyRqd.Text)
);
Patch(
 'Internal Stock Cupboard',
 LookUp(
 'Internal Stock Cupboard',
 ID = ThisItem.ID
 ),
 {Quantity: Value(ThisItem.Quantity-QtyRqd.Text)}
);
Set(
 var_order_title,
 ThisItem.Title
);
Set(
 var_order_qty,
 Value(QtyRqd.Text)
);
Set(
 var_vpn,
 ThisItem.VPN
);
Set(
 var_item_cost,
 ThisItem.Cost
);
Navigate(
 Success,
 ScreenTransition.Fade
)
Categories:
I have the same question (0)
  • Verified answer
    WillPage Profile Picture
    2,311 Super User 2026 Season 1 on at

    I haven't figured this out, but I got a workaround. I set another variable with the same value and on the next screen I used one of them to patch a new record into a list called orders when a "completed" button is pushed and the other to display to the user in a label. 

     

    Seems like if I tried to use the same variable twice on the next screen it would go to 0, but not in the Studio. Maybe it's a bug.

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!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 549 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 225 Super User 2026 Season 1

#3
Haque Profile Picture

Haque 224

Last 30 days Overall leaderboard