FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Problem with numeric fields and FWH 25.01
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Problem with numeric fields and FWH 25.01
Posted: Wed Mar 19, 2025 11:12 AM
Hi Guys,
IF I run the code bellow with my previous version of FWH. I can see the value 3.3732. But if i run this same code with the new version of FWH, the value showed is 3.37. Do you know why ?

function Main()
LOCAL oRs,oCn,oError,oQry,cQryMat

   SET DATE BRIT
   SET CENTURY ON
   
   CursorWait()

   oCn := Maria_Connect( aStr[1] )

   oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig FROM consumo WHERE nfiscal LIKE '000005829%'")
   cQryMat := ""
   DO WHILE .NOT. oRs:Eof()
      cQryMat += "'"+oRs:cmat+"',"
      ? oRs:qte,oRs:qtedig,oRs:cmat
      oRs:Skip()
   ENDDO
   oRs:GoTop()
   
RETURN NIL
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 20, 2025 05:19 AM

Dear Vilian,

Are you using SET DECIMALS TO 4 ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 20, 2025 10:44 AM
Antonio,
No I'm not setting any value to SET DECIMAL. However, is important note that the problem is only happening with decimal values from Mysql rowset/queries. IF I try something like:
function Main()
LOCAL nVal1,nVal2,nRes

   SET DATE BRIT
   SET CENTURY ON
   
   nVal1 := 2.3432
   nVal2 := 2.3923
   nRes := nVal1 * nVal2 
   ? nRes
   
RETURN NIL
Everything is fine.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 20, 2025 12:55 PM
The code Bellow:
oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig,valor FROM consumo WHERE nfiscal LIKE '00023332601%'")
? oRs:qte,oRs:valor,oRs:qte*oRs:valor
In FWH2311 shows this:


In FWH2501 shows this:
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 27, 2025 12:11 PM

Any progress?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 27, 2025 07:39 PM

Dear Vilian,

What is previous FWH version that you were using ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Thu Mar 27, 2025 11:08 PM

my previous version is FWH 23.11

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 04:24 AM

Dear Vilian,

I need you to help me to build a small example that I can run here and that generates the error.

Mr. Rao continues at the hospital, so we have to fix it ourselves.

We need to identify the exact FWH version where such error started so we can review the source code diferences.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 10:45 AM
Dear Antonio,

IF you have any table in your mysql server where you have numeric fields with more than 2 decimals. Just run the code bellow and you'll see the problem.
oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig,valor FROM consumo WHERE nfiscal LIKE '00023332601%'")
? oRs:qte,oRs:valor,oRs:qte*oRs:valor
In my case QTE,QTEDIG and VALOR are numeric fields with more than 2 decimals

Mr Rao told me this:
1) Good morning your point about the numeric fields is correct This is an unfortunate bug I'll try to fix it as soon as I can
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 01:19 PM
vilian wrote: Dear Antonio,

IF you have any table in your mysql server where you have numeric fields with more than 2 decimals. Just run the code bellow and you'll see the problem.
oRs := oCn:Query("SELECT nfiscal,cmat,qte,qtedig,valor FROM consumo WHERE nfiscal LIKE '00023332601%'")
? oRs:qte,oRs:valor,oRs:qte*oRs:valor
In my case QTE,QTEDIG and VALOR are numeric fields with more than 2 decimals

Mr Rao told me this:
1) Good morning your point about the numeric fields is correct This is an unfortunate bug I'll try to fix it as soon as I can
I try this


Perhaps you have a round number ?
can I have a small test to try , perhaps I try to search a solution
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 02:38 PM

Silvio,

The problem is happening only with numeric fields from a rowset. With variables everything is ok, like i said before.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 05:27 PM

Then It Is AN error of mariadb ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 06:00 PM

Yes.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 07:12 PM

Dear Vilian, structure table or type of this fields?, thanks

Cristobal Navarro

Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la nociĂłn del tiempo

El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Problem with numeric fields and FWH 25.01
Posted: Fri Mar 28, 2025 07:17 PM
Dear Cristobal,

The type of the fields is:

QTE DECIMAL(11,3)
VALOR DECIMAL(12,4)
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil