Forum Discussion

matt_bostrom's avatar
matt_bostrom
New Contributor II
8 years ago

If within mapper

i’ve seen this before just cannot remember the syntax. how can i do an IF within a mapper? i want to say that if the $inventory != 0 then perform $period_revenue / $inventory = $price_per_unit other wise price_per_unit = 0

i’ve seen something like a switch statement before like $inventory != 0 : $period_revenue / $inventory but cannot remember the exact syntax.

2 Replies

  • del's avatar
    del
    Contributor III

    try
    $inventory != 0 ? $period_revenue/$inventory : 0

    • matt_bostrom's avatar
      matt_bostrom
      New Contributor II

      ah wonderful that did the trick! i forgot about the question mark.