if/or function in podio calculations
AnsweredHello all,
i´m a java script newbie and am looking for a way to implement a if/or function into podio.
doesn't seem to be as easy as i thought :)
i have the following fields:
Nationality: Deutschland, England, USA (its a dropdown Menu with differnt countries)
Sum1: 1.000 €
Sum2: @Nationality=="Deutschland. Going to Apply" || @Nationality=="Did Not Apply" ? 0 : @Sum1 * 0.15
As you can hopefully see I want Sum2 to be 0 if Nationality is chosen as "Deutschland", but calculate Sum1 * 0.15 if another Nationality is chosen.
The way i did it isnt correct, simply as its not working :)
can anyone help me?
Thanks so much!!
-
Rainer may I ask one further question? Assuming i just want the calculation if we add add another condition. can i put it in the same formula?
Nationality: Deutschland, England, USA (its a dropdown Menu with different countries)
Number: 1, 2, 3, 4, 5 .... (dropdown menu as well)
Sum1: 1.000 €
Sum2: @Nationality=="Deutschland. Going to Apply" || @Nationality=="Did Not Apply" ? 0 : @Sum1 * 0.15i would like to add a second condition now besides the nationality and let him only calculate @Sum1 * 0,15 if also "Number * 250 is < than Sum1.
i thought i can easily add it but again i wasnt correct. sorry, thats the last thing i need then for now :)
-
It's never the last question :) the more you work with the calculation fields the more you want to get out of it.
What should the result be, if number >= sum1? Should it be 0?This should work:
var nat =@nationality: var sum1 = @sum1; var num = @number; nat == "Deutschland" || nat == "" ? 0 : (nat != "Deutschland" || nat != "") && num < sum1 ? sum1 * 0.15 : 0
Don't know what "250" should mean? And is "Did Not Apply" a category in Nationality?
Rainer
-
can i add as much variables to this as i want or would that completely change the syntax? i tried with java forums as well so i don't need to bother to much but there the "language" is still different from what is used in podio. to make it simple, i wanted to add one var called "50a" with the buttons yes or no. when yes it shoudl still calculate the below. if no then not. i tried to add it somehow but always syntax problems.
var 50a = @50a;
var nat =@nationality;
var sum1 = @sum1;
var num = @number;nat == "Deutschland" || nat == "" ? 0 : (nat != "Deutschland" || nat != "") && 50 == "yes" II 50a == "" ? 0 : (50a != "yes" || 50a != "") && num < sum1 ? sum1 * 0.15 : 0
hope this is not to funny. i clearly don`t understand that much but i tried hard with different options.
-
Hi Björn,
there are some mistakes in your script. Keep it simple: make the calculation a variable and add one of the IF-conditions for 50a:
var 50a = @50a; var nat =@nationality; var sum1 = @sum1; var num = @number; var calc = nat == "Deutschland" || nat == "" ? 0 : (nat != "Deutschland" || nat != "") && num < sum1 ? sum1 * 0.15 : 0; 50a == "No" ? 0 : calc // calculates also if in 50a nothing is selected 50a == "Yes" ? calc : 0 // calculates only if in 50a "Yes" is selected
Rainer
-
thank you. thats a really big help and indeed looks way easier. however something seems not to work yet. i now have:
var 50a = @50a;
var nat =@nationality;
var sum1 = @sum1;
var num = @number;var calc = nat == "Deutschland" || nat == "" ? 0 : (nat != "Deutschland" || nat != "") && num * 250 < sum1 ? sum1 * 0.15 : 0;
50a == "ja" ? calc : 0
i added a * 250 after the num as he is only supposed to calculate if num * 250 is bigger then the sum1 he is taking.
how can i thank you? flowers? :) -
haha, would be happy to help. but mhh, cant get it to work with either one of the options. maybe the whole actualy syntax as i have it in my system now as i changed the names of the references. in podio as well for sure and works with all other calculations. so cant be about that.
var 50a = @50a/Soli bei uns?;
var nat = @All of Akt. Wohnort (Besteuerungsgrundlage);
var sum1 = @Finale Gage / Honorar;
var num = @Anzahl Musiker bei diesem Konzert * 250;var calc = nat == "Deutschland" || nat == "" ? 0 : (nat != "Deutschland" || nat != "") && num < sum1 ? sum1 * 0.15 : 0;
50a == "ja" ? calc : 0
do you see a mistake still? idea behind it again, calculation of finale gage / hororar * 15% shall just apply when its not "Deutschland" and if "anzahl musiker.." * 15% is bigger than "finale gage / honorar". really dont get whats wrong still.
-
Maybe you can store the screenshot in a cloud service and share the link. Or send it to rg@delos-consulting.com
Please sign in to leave a comment.
Comments
16 comments