cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
schwibach
Resolver I
Resolver I

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

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 

 

1 ACCEPTED SOLUTION

Accepted Solutions
schwibach
Resolver I
Resolver I

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! 

View solution in original post

4 REPLIES 4
schwibach
Resolver I
Resolver I

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! 

View solution in original post

timl
Super User III
Super User III

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

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

 

RandyHayes
Super User III
Super User III

@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! 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (53,362)