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 / Making a button increm...
Power Apps
Answered

Making a button incrementing a variable by 1 (what am I doing wrong?)

(0) ShareShare
ReportReport
Posted on by 2 Moderator

Hey guys,

 

i'm drawing a blank. I thought I knew how to set and change variables, but it turns out I don't.

 

I'm working on an app to give people the chance to report a number and status (vertical slider hidden in front of the traffic lights). This is what my draft looks like.

 

schwibach_0-1610792466079.png

I want to make buttons (arrows, +/- signs) change the variable to the left, which will then be taken 

So I wrote this in "On Select" of the first little Up-Arrow

 

Set(varangemeldetbvjkneu; varangemeldetbvjkneu + 1)

 

 

The variables for the lower 4 numbers (the new ones to be filling in a form and then be submitted to an SP-list) are defined On Start:

 

Set(varanwesendbvjkneu; LookUp(Sort(BVJ_Schülerzahlen; Created; Descending); Direktorat = vardirektorat; BVJk_anwesend_gesamt));;
Set(varangemeldetbvjkneu; LookUp(Sort(BVJ_Schülerzahlen; Created; Descending); Direktorat = vardirektorat; BVJk_angemeldet_gesamt));;

Set(varanwesendbvjsneu; LookUp(Sort(BVJ_Schülerzahlen; Created; Descending); Direktorat = vardirektorat; BVJs_anwesend_gesamt));;
Set(varangemeldetbvjsneu; LookUp(Sort(BVJ_Schülerzahlen; Created; Descending); Direktorat = vardirektorat; BVJs_angemeldet_gesamt));;

 


If Ieave "On select" of the arrow blank, the label will show the value of the variable correctly.

If I type in the code above, it shows me an error and the label will stay empty 

 

Categories:
  • Verified answer
    schwibach Profile Picture
    2 Moderator on at

    I figured it out.... The data type in the SP list was Text not Number, so the calculations did not work.

     

    By the way, the traffic lights work nicely! 

  • timl Profile Picture
    37,418 Super User 2026 Season 2 on at

    Thanks for sharing the answer @schwibach! Did you fix this by changing the data type of your SharePoint column to number?

  • schwibach Profile Picture
    2 Moderator on at

    That's exactly right, and then it worked automagically 🙂

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @schwibach 

    Since you seemed to like some of the ease of some functions like the Switch function in your other post, I thought I might introduce you to the With function (if you're not already familiar) - another power function that helps cut down on the typing and troubleshooting.

    With({_rekord: LookUp(Sort(BVJ_Schülerzahlen; Created; Descending); Direktorat = vardirektorat)};
     Set(varanwesendbvjkneu; _rekord.BVJk_anwesend_gesamt);;
     Set(varangemeldetbvjkneu; _rekord.BVJk_angemeldet_gesamt);;
    
     Set(varanwesendbvjsneu; _rekord.BVJs_anwesend_gesamt);;
     Set(varangemeldetbvjsneu; _rekord.BVJs_angemeldet_gesamt);;
    )

     

    Of course, technically, you could be just setting 1 variable to the actual record and then using any of its values rather than creating 4 variables.  But that was not the point of my response.

    Just mentioning With....enjoy! 

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 130

Last 30 days Overall leaderboard