I have a slider that has three settings: 0 1 2
and want to write some text into a Sharepoint list depending on the value.
Now, I put a textbox in the powerapp with 'Slider_BVJ/k_neu' in the text field.
The readout is correct, I can change on the fly from 0 to 1 to 2
Now, if I try to do a logical test in a text box like
'Slider_BVJ/k_neu' = 2
it gives back an error instead of true or false which I would have suspected.
I think that is why my if functions don't work.
Ultimately, I want a certain text
"Ja, problemlos" if the value is 0
"Ja, mit Problemen" if the value is 1
"Nein, auf keinen Fall" if the value is 2
in a form that will update my sharepoint list when I click a button.
First, I'm wondering why the slider value is not working as expected.
Second, I'm wondering what's the proper way to do this
I see 2 ways
1. In the slider write the following lines in "On change"
Set (varaufnahmebvjsneuzahl; 'Slider_BVJ/s_neu');;
Set (varaufnahmebvjneu; if ('Slider_BVJ/s_neu' = 0; "Ja, problemlos"; 'Slider_BVJ/s_neu' = 1; "Ja, mit Problemen"; "Nein, auf keinen Fall");;
2. In the DataCardValue on the form in "Default"
If('Slider_BVJ/s_neu' = 0 ; "Ja, problemlos" ; 'Slider_BVJ/s_neu' = 1 ; "Ja, mit Problemen" ; "Nein, auf keinen Fall")
However, neither works.
Any ideas?
Solved! Go to Solution.
Yes, you do need to first use the .Value property of the slider to get its value. You can't just use the control name.
To make your formula a little easier to read, consider this:
Switch('Slider_BVJ/s_neu'.Value;
0; "Ja, problemlos";
1; "Ja, mit Problemen";
2; "Nein, auf keinen Fall"
)
SO...this will all be fine. The approach I took in the response was to address editing a record. As you have it now, if you were to edit an existing record, your slider will not reflect the value stored in the record being edited - perhaps that's not even a concern in your app, but I wanted to at least provide that solution as well.
Skip the variables for all of this!
I am assuming that the Slider is IN your form in the DataCard for a record field.
Your Default for the DataCard should be ThisItem.yourDataColumn
The Default on your Slider should be:
Switch(Parent.Default;
"Ja, problemlos"; 0;
"Ja, mit Problemen"; 1;
"Nein, auf keinen Fall"; 2
)
The Update property of your DataCard should be:
Switch(yourSliderControlName.Value;
0; "Ja, problemlos";
1; "Ja, mit Problemen";
2; "Nein, auf keinen Fall"
)
Again, all of this is predicated on your Slider being in the form itself and not outside of it.
I hope this is helpful for you.
Thanks... Unfortunately, the slider is outside of it.
I wanted the design to be independent of.
I could redesign that part of the app to be a form.
The reason I didn't choose to go with a form is that the users are supposed to report numbers and I wanted to make it more comfortable to change the numbers with buttons and choose from the 3 states with a slider.
The upper part shows what was last reported. And the lower part gives you the option to report new values.
Hey Randy, your response tipped me off though!
I looked at what you're doing and think I figured out how to make it work outside the form, too.
I added . Value to my code and now it's working (in a textbox)
If ('Slider_BVJ/s_neu'.Value = 0; "Ja, problemlos"; 'Slider_BVJ/s_neu'.Value = 1; "Ja, mit Problemen"; "Nein, auf keinen Fall")
I'll test it in the form, too.
Yes, you do need to first use the .Value property of the slider to get its value. You can't just use the control name.
To make your formula a little easier to read, consider this:
Switch('Slider_BVJ/s_neu'.Value;
0; "Ja, problemlos";
1; "Ja, mit Problemen";
2; "Nein, auf keinen Fall"
)
SO...this will all be fine. The approach I took in the response was to address editing a record. As you have it now, if you were to edit an existing record, your slider will not reflect the value stored in the record being edited - perhaps that's not even a concern in your app, but I wanted to at least provide that solution as well.
Thanks for teaching me the Switch function. Already implemented it in two other places.
My form is somehow not submitting.
The troubleshooting never ends 😉
So, that formula should be on the Update property of your datacard in your form. That will submit the proper text assuming that the underlying column/field is a Text column.
User | Count |
---|---|
184 | |
124 | |
89 | |
45 | |
43 |
User | Count |
---|---|
262 | |
160 | |
128 | |
81 | |
75 |