Overwrite function with Combobox
Hi :)
I have a function like this:
if Price < 500 then
Price * 0.5
else
if Price < 1000 then
Price * 0.6
else
if Price >= 1000 then Price * 0.7 end
end
end
I also have a Cobobox with percentages (10%, 20%, 30%, ... etc.). The idea is, that if I leave the Combobox blank, the above function should rule. But if i choose a value in the Combobox, the above function shall be "replaced" with another function (Price * Combobox).
Make sense? I am rather new to functions, so bare with me :)
Thanks in advance!
2 replies
-
You can do something like this:
if Combobox != null then
Price*Combobox
else
your previous code
end
If you combobox has text then you will need to either change them to just numbers or create a variable that converts the text into a number.
So you combobox could end up just being numbers like 10, 20, 30 etc.
or
you would add a line to your formula like:
let xPerc := switch Combobox do
case 1:
.1
case 2:
.2
case 3:
.3
end;
if Combobox != null then
Price - round((Price*xPerc).2)
else
your previous code
end
Good luck.
-
YES! Thank you @Fred!
Couldn't get the conversion of Combobox inputs to numbers to work, though, but it all worked out with your code + a regular input field instead.
Thanks again, struggled with that for three nights in a row! :DSimon
Content aside
- 3 yrs agoLast active
- 2Replies
- 344Views