agworld/soroban — pull request #2 by ozzyaaron (2014-04-01 05:15:27+00:00)
Title: Fix up modelling issues that we’re encountering

To make some of the models more robust I’ve introduced the ISBLANK and COUNTBLANK functions. This allows us to then exclude values depending on whether we have all the required inputs or not.

eg. IF( COUNTBLANK( sample_inputs ) = 0, sample_outputs, 0 ) can be a common use case.

Also what I found was that it’s relatively easy to end up up with a model that seems to work in Excel but doesn’t work in Soroban. The main reason so far has been that Excel will show an empty string as a 0 if the cell has been set to output numbers. Further calculations based on this number then work. As Soroban uses the base value ( empty string ) then calculations like N129-N128 would fail if N129 or N128 evaluate to a blank string.

The *simple* way to fix this is to attempt to coerce cell values to a float where appropriate. This is a blunt fix but will probably work quite well. The more appropriate fix is to probably handle this in the grammar. The assumption being that an additive or multiplicative operation should only involve numbers and the expression should not be valid with anything but numbers. This fix would require more time than I have right now given we have a practical fix in place with this PR.