Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: stonysmithYou've found a very odd bug in the parser. It should have thrown a (better) error message.
The "I" on the "if" operator should be lower case. Make it "if" and the error goes away.
However, you've also got another issue... in two places you're using "double" function incorrectly.
You also do not need to test the numerator, only the denominator of the divide.
Here is the corrected version:
if ('Customer Count'.int()==0)
then AverageTicket = double(0)
else AverageTicket= ('sales'.double() / 'customer count'.int())
emit AverageTicket
=======
Now, to get all technical.. if you do need to test a "double" data type, then (abs(Sales.double()) < 0.000001)
is a better than the ('Sales'.double() ==0) you were using.
Because of floating point rounding errors, it's best to use "less than" some very small number rather than "equality".