cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
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
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

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 🙂

 

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
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

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

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (63,158)