if/or function in podio calculations

Answered

Comments

16 comments

  • Rainer Grabowski (FVM)

    Hi Björn,

    @Nationality== "Deutschland" || @Nationality == "" ? 0 : @Sum1 * 0.15
    

    If "Deutschland" is selected or if no Nationality is selected = 0, for every other Nationality "@sum1*0.15".

    Rainer

    0
    Comment actions Permalink
  • Björn Bauch

    wow, that was fast. and its working. thank you so much! i will have a look at it know to 100% understand and learn from it. thank you thank you!

    0
    Comment actions Permalink
  • Björn Bauch

    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.15

    i 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 :)

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    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

    0
    Comment actions Permalink
  • Björn Bauch

    you are probably right. but! what you sent is working. so happy right now. i now have all functions i need for my calculations :)

    0
    Comment actions Permalink
  • Björn Bauch

    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.

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    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

    0
    Comment actions Permalink
  • Björn Bauch

    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? :)

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    Try
    (num * 250)
    or
    var num = @number * 250

    No flowers necessary : ) Better weather would be great. It's pouring down in Munich.
    Rainer

    0
    Comment actions Permalink
  • Björn Bauch

    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.

    0
    Comment actions Permalink
  • Björn Bauch

    btw. it says: "Skript-Syntax-Fehler: Unexpected Token ILLEGAL"

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    Are all @fields marked blue?
    Why is "nationality" now a @All of field?
    Can you share a screenshot?

    0
    Comment actions Permalink
  • Björn Bauch

    its referenced from another app but did work easily this way before i wanted to add another variable to the calculation. screenshot. i´d love to but dont know how to add pictures here.

    and yes. all fields are marked blue and actively linked.

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    Maybe you can store the screenshot in a cloud service and share the link. Or send it to rg@delos-consulting.com

    0
    Comment actions Permalink
  • Björn Bauch

    sent via email. thank you!

    0
    Comment actions Permalink
  • Rainer Grabowski (FVM)

    Sorry, my oversight. Var Names must begin with a letter (or $ or _), The name of the first var 50a is not valid, therfore you get the error notification. Just change the var name and it should work.

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk