[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ic] IC does not see 0.00 is as 0 for DECIMAL(6, 2) fields in MySQL


> I am using MySQL with interchange and would like to format my
> sale_price column as DECIMAL(6,2), rather than the current CHAR(8).
>
> However, I have noticed that if I do this, then [if-sql-param
> sale_price] always returns true, even if sale_price is nil.
>
> I am guessing that this is because Interchange stores 0 as "0.00" for
> DECIMAL(6.2) and that consequently [if-sql-param] sees 0.00 as a
> string of 4 characters, rather than a numeric zero.
>
> Is there an efficient way around this problem?  I say, "efficient",
> because I use this [if-sql-param sale_price] within loops, so the tag
> may get called 100s of times, so I really don't want to hurt
> performace at all by adding extra overhead to the loop.  e.g.  I have
> thought of setting a scratch variable inside the loop as follows:
>
> [tmp][calc][scratch sale_price][sql-param]+0[/calc][/tmp]  or using
> [if-sql-param sale_price > 0] but I feel this may be a lot slower
> than just plain [if-sql-param]
>
Whoops big syntax error - it's been a long day.  The code example should
say:
[tmp sale_price][calc][sql-param]+0[/calc][/tmp]

Anyway, my original question still stands - any suggestions would be greatly
appreciated.  Thanks

_______________________________________________
interchange-users mailing list
suppressed
http://www.icdevgroup.org/mailman/listinfo/interchange-users


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.