Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Currency problems
Message
From
12/03/2004 02:08:51
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Currency problems
Miscellaneous
Thread ID:
00885487
Message ID:
00885487
Views:
58
Dear Experts,

I have the following situation.

I'm using some cursors with currency fields. The problem I get is currency overflow when the result of a multiplication exceeds the maximum currency or numeric value.

For example:

case 1:
** Using currency for calculations
CREATE CURSOR test (field1 y,field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)

SELECT IIF(field1*field2>922337203685477.5807,922337203685477.5807,field1*field2) as newfield;
from test;
INTO CURSOR new && CURRENCY VALUE OUT OF RANGE ERROR

case 2:
** Using numeric for calculations
CREATE CURSOR test (field1 n(16,4),field2 I)
INSERT INTO test(field1,field2) VALUES (123456789012345.6789,123456789)

SELECT IIF(field1*field2>999999999999999.9999,999999999999999.9999,field1*field2) as newfield;
from test;
INTO CURSOR new && NO ERRORS

The case I'm interested is case 1. Unfortunately I cannot use Numeric for all the calculations.

Can anyone help my solve this problem? (except from changing my fields to numeric)

Thanks In Advance,

Spyros
Next
Reply
Map
View

Click here to load this message in the networking platform