Anyway I could get some help with this. Total noob "If this then that, else this"

Comments

8 comments

  • Rainer Grabowski

    Hi Kevin,
    you have 2 options how to write the code, both do the same:

    var arv  = @ARV;
    var  repair = @Repair Costs;
    var sum = arv - rep;
    var multi =  arv <=120000 ?  .7 : .83;
    var result  = sum * multi;
    result

    or

    var arv  = @ARV;
    var  repair = @Repair Costs;
    var sum = arv - rep;
    var multi =  0;
    if(arv <=120000) { 
       multi = .7;
    } else {
       multi = .83;
    }
    var result  = sum * multi;
    result

    Rainer

     

    1
    Comment actions Permalink
  • Andrew Wardle

    Try this

    (@ARV<=120000?((@ARV-@Repair Costs)*.7):(@ARV-@Repair Costs)*.83))

     
    1
    Comment actions Permalink
  • Bavo De Cooman

    Hi Kevin,

    You could try

    (@ARV<=120000) ? (@ARV-@Repair Costs)*.7 : (@ARV-@Repair Costs)*.83 

    Hope this helps!

    Kind regards

    Bavo

    1
    Comment actions Permalink
  • Kevin Tanner

    Thanks for the help, but with all the suggestions I am getting 

    The calculation field must reference at least one other field. It cannot be entirely based on static data, such as strings or numbers.

    0
    Comment actions Permalink
  • Andrew Wardle

    When you type the @ symbol the field token will appear below the edit window, select the relevant field from the list using the arrow keys and <Enter>. The field should appear in shaded blue like below.

    1
    Comment actions Permalink
  • Bavo De Cooman

    Hi Kevin

    The @signs need to be (re-)activated to be used in a calculation field. 

    So where you have @ARV, for example, remove the V and you will see that the calculation field will suggest you connect to the field "ARV". Or else, remove the @statement altogether and re-type @ARV . A field suggestion should appear

    If you want to make a calculation field fully based on static data, make a blue token to any field as a comment in the code (starting with double slash), for example @unique id

    // @unique id

     

    1
    Comment actions Permalink
  • Rainer Grabowski

    Please add a screenshot of your calculation field. 
    Here https://help.podio.com/hc/en-us/articles/201019358-Calculations you find some helpful tips for beginners. Check also the PDF attached at the bottom of the help article.

    1
    Comment actions Permalink
  • Kevin Tanner

    That was the problem, thanks so much for everyones help

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk