LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  If Then Loop for EMIT

    Employee
    Posted 01-18-2019 09:13

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: LifHkr

    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.  RE: If Then Loop for EMIT

    Employee
    Posted 01-18-2019 09:28

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: gmullin

    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() 
    else 
      penAmt = 'Invoiced Amount' 
    
    emit penAmt as "Penalty Amount"


  • 3.  RE: If Then Loop for EMIT

    Employee
    Posted 01-18-2019 09:50

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: LifHkr

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