How to precisely define numeric datatypes in foxpro table using clarion dictionary

We need to integrate our software into an old foxpro based program. The requirement should be that we could produce a specific required foxpro file that can be read by their program. Right now I am having problems on REAL datatype defined in clarion for that specific foxpro table(REAL in clarion = FLOAT in foxpro counterpart) because it can only accomodate up to 10 maximum digits including decimal. but upon on documentation it can accomodate up to 20 digits (20,18)
If my value writing to specific REAL datatype on the foxpro file exceeds that 10 digit, it gets me a record insert error

Is there a proper way of defining REAL datatype in foxpro tables assigning their maximum digits?

No idea, but could you do it with a decimal definition instead of REAL?

there is no DECIMAL option in the dictionary when the file driver selected is FoxPro, same with DBase files and DOS files

.
I tried creating the table in the source first but I could not be able to identify the errors, so that I put it in the dictionary first.

Try STRING, maybe that will work?

Ah, that’s a real gotcha! (No pun intended :grinning_face_with_smiling_eyes:)

Perhaps run the value through a local decimal first and then plug it back into the database REAL?

e.g.

Loc:DecimalNumber = dat:RealNumber
dat:RealNumber = Loc:DecimalNumber

Sorry for misunderstanding, you mean this?
image
I have predefined my source value from decimal data type
image
when my value exceeds 10 digits(including decimal and decimal point, not including comma separated) I still get the bad data error, sample pic is the value that i need to put to the foxpro record
image

I have tried other workaround such as:

  • Modifying the actual dbf file created by altering all REAL column data type by increasing their size to be able to accomodate large numeric values using DBF Viewer


    I tried adding large numeric values directly in this dbf viewer, no problem, but clarion still does not allow adding large numeric values exceeding to 10 digits. The only thing that works after altering the table originally produced by my clarion program is it does not produce invalid record declaration error.

  • Another workaround I tried is importing that modified dbf file back to clarion dictionary. Handling REAL datatypes defaults to @n10.2 , which is still doesn’t work

I think this could be my last workaround, but as per the documentation for the integration, they require numeric field instead of alphanumeric for every specific column that requires numeric value.

Try defining your decimal as (10,2) instead of (12,4)

This might not work as I don’t know how a Clarion REAL gets sent to Foxpro, it’s possible that all Clarion REALs are going to be too big?

My theory behind the suggestion is that assigning the value to a decimal 10,2 will trim the output to the REAL to 10 digits. Easy enough to try.

BTW, the picture @N12.4 only affects the screen display, not the size of the data.