Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Currency problems
Message
De
12/03/2004 02:08:51
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Titre:
Currency problems
Divers
Thread ID:
00885487
Message ID:
00885487
Vues:
59
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform