Results 1 to 3 of 3

Thread: If Then Loop for EMIT

  1. #1

    Default If Then Loop for EMIT

    I'm still new to Lavastorm so I do not know the correct syntax. I'm trying to compare 2 values and emit the lower value as a "Penalty Amount"

    I'm trying to say that if the 'Invoiced Amount' is greater than b then use the b else use the 'Invoiced Amount'

    a = count()   Is a count of the records
    b = (a*'Days to Complete'*25).ifNull(0).double()   Multiplies number of records by days and by 25
    if  'Invoiced Amount'  > b then    
    	emit b.ifNull(0).double() as "Penalty Amount"
    	else emit 'Invoiced Amount' as "Penalty Amount"

  2. #2
    Lavastorm Employee gmullin's Avatar
    Join Date
    May 2014


    You'll have to have a single emit statement rather than 2. Give this a try.

    if  'Invoiced Amount'  > b then    
      penAmt = b.ifNull(0).double() 
      penAmt = 'Invoiced Amount' 
    emit penAmt as "Penalty Amount"

  3. #3


    That did the trick. Thank you so much for the quick response.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts