Problem with numeric fields and FWH 25.01

User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Problem with numeric fields and FWH 25.01

Post by vilian »

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 ?

Code: Select all | Expand

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
User avatar
Antonio Linares
Site Admin
Posts: 42715
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by Antonio Linares »

Dear Vilian,

Are you using SET DECIMALS TO 4 ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

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:

Code: Select all | Expand

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
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

The code Bellow:

Code: Select all | Expand

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:
Image

In FWH2501 shows this:
Image
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Any progress?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Antonio Linares
Site Admin
Posts: 42715
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by Antonio Linares »

Dear Vilian,

What is previous FWH version that you were using ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

my previous version is FWH 23.11
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
Antonio Linares
Site Admin
Posts: 42715
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by Antonio Linares »

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
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

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.

Code: Select all | Expand

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
User avatar
Silvio.Falconi
Posts: 7232
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: Problem with numeric fields and FWH 25.01

Post by Silvio.Falconi »

vilian wrote: 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.

Code: Select all | Expand

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

Image
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
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

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
User avatar
Silvio.Falconi
Posts: 7232
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: Problem with numeric fields and FWH 25.01

Post by Silvio.Falconi »

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
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

Yes.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
User avatar
cnavarro
Posts: 6601
Joined: Wed Feb 15, 2012 8:25 pm
Location: España
Has thanked: 6 times
Been thanked: 8 times

Re: Problem with numeric fields and FWH 25.01

Post by cnavarro »

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
User avatar
vilian
Posts: 1004
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Has thanked: 3 times
Contact:

Re: Problem with numeric fields and FWH 25.01

Post by vilian »

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
Post Reply