Discussions

Expand all | Collapse all

Formula Field variables set in an if statement

  • 1.  Formula Field variables set in an if statement

    Bronze
    Contributor
    Posted 02-28-2019 17:23
    I am trying to assign a variable value in a formula field... but with the catch that the criteria is if a number is greater than 0... Example:

    If([Branch - H&W Deferred Rate]>0,

    var number Rate = [Branch - H&W Deferred Rate];,

    var number Rate = [Branch - H&W Cash Rate];)

    I've attempted the Case Switch... but that didn't work the way I need it to.


  • 2.  RE: Formula Field variables set in an if statement

    Posted 02-28-2019 17:28
    Formula variables are great but in this case they are not necessary

    If([Branch - H&W Deferred Rate]>0,

    [Branch - H&W Deferred Rate], [Branch - H&W Cash Rate])


  • 3.  RE: Formula Field variables set in an if statement

    Bronze
    Contributor
    Posted 02-28-2019 17:31
    Normally you would be accurate... but I'm setting the variable, as depending on the criteria, determines which values I need for calculations in this formula.


  • 4.  RE: Formula Field variables set in an if statement

    Bronze
    Contributor
    Posted 02-28-2019 17:32
    I was able to figure out the solution... Please see below:

    var Number Rate = If([Branch - H&W Deferred Rate]>0, [Branch - H&W Deferred Rate],[Branch - H&W Cash Rate]);


    This was part of a huge calculation field, hence why I wanted the use the variable here.