Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacement issue in foxpro [Numeric overflow. data was lost]

Status
Not open for further replies.

Niki_S

Programmer
Jun 4, 2021
232
0
0
LK
Code:
SELECT OutstandingStatus_ACP
SCAN 
	IF (OutstandingStatus_ACP.nPoQty>=OutstandingStatus_ACP.nGrnValue) THEN 
		SELECT OutstandingStatus_ACP 

			replace OutstandingStatus_ACP.nNotGRN WITH OutstandingStatus_ACP.nGrnValue

	ELSE
		SELECT OutstandingStatus_ACP 

			replace OutstandingStatus_ACP.nGRNComplt WITH OutstandingStatus_ACP.nGrnValue

	ENDIF 
ENDSCAN

I used this to replace my nGrnValue to new fields. When I run my code it says Numeric overflow. data was lost.
How can I fix this?
 
Hello,

check the data and the datatype (via debugger or logging) , it seems you set datatype of .notgrn or ngrncomplt too small for the new value
(I usually set all fields with amounts to num 12,2, just in case)

Regards
tom
 
I tried it by using 12,2 too, but still it says the same error.
 
Check your structures are matching for nNotGrn, nGRNComplt, and nGRNValue

If in doubt make them both 14,2 and try again.

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.
 
It also not working. There have same error. However I tried this way and it is working.
Code:
SELECT nPoDtlID,nGrnValue FROM OutstandingStatus_ACP INTO CURSOR _GRNval

SELECT _GRNval
INDEX On nPoDtlID TAG PoDtlID

SELECT OutstandingStatus_ACP 
   SCAN
   IF (OutstandingStatus_ACP.nPoQty>=OutstandingStatus_ACP.nGrnValue) THEN 
	   SELECT _GRNval
	   SEEK OutstandingStatus_ACP.nPoDtlID 
	   
	   SELECT OutstandingStatus_ACP 
	   REPLACE nNotGRN WITH _GRNval.nGrnValue
	ELSE 
	   SELECT OutstandingStatus_ACP 
	   REPLACE nGRNComplt WITH _GRNval.nGrnValue
	ENDIF 
   ENDSCAN
Thank you all
[bigsmile]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top