Bug 166494 - Wrong usage of decimal data(?)
Summary: Wrong usage of decimal data(?)
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
24.8.6.2 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-07 14:43 UTC by Tom
Modified: 2025-05-22 15:05 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
test, macro correction (282.54 KB, image/jpeg)
2025-05-14 12:47 UTC, mc
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom 2025-05-07 14:43:49 UTC
Using Windows11 (Dutch settings)
LO-version 24.8.6.2
Database: Firebird (defined as server)

Table in Firebird: JAREN 
Key-field       J_NR Integer
Relevant field: J_OPBR numeric (5,1)
Table in LO: JAREN
Relevant field: J_OBR number        

Macro used:
Global iOPBR as single
Global sSQL as string

SUB ReadInfo
   sSQL = "Select J_OBR from JAREN where J_NR = 2025"
   oConnect=ThisDatabaseDocument.DataSource.getConnection("","")
   oQuery=oConnect.CreateStatement()
   oResult= oQuery.executeQuery(sSQLstring)
   oResult.Next
   iJaarOpbrVerw = oResult.getstring(1)
etc.
End sub

When running as SQL in LO the result is 10,5

When displaying de value of iOPBR in macro the value is 105

When using iJOPR to populate a form-field defined with 1 decimal the value displayed is also 105 and not 10,5 as expected.

What do I wrong and how to correct?
Comment 1 Tom 2025-05-07 14:49:13 UTC Comment hidden (me-too)
Comment 2 fpy 2025-05-07 18:48:31 UTC
please attach a .odb to exhibit your bug.

https://wiki.documentfoundation.org/QA/BugReport#Description_and_attachments
Comment 3 mc 2025-05-14 12:47:12 UTC
Created attachment 200802 [details]
test, macro correction

Hi, see correction of your macro. Problem is Macro

Global iOPBR as single
Global sSQL as string

SUB ReadInfo
   sSQL = "Select deci_mal, nume_ric from Tabella1"
   oConnect=ThisDatabaseDocument.DataSource.getConnection("","")
   oQuery=oConnect.CreateStatement()
   oResult= oQuery.executeQuery(sSQL)
   oResult.Next
   iOPBR  = oResult.getdouble(1)
   dec   = oResult.getstring(1)
   num  = oResult.getstring(2)
   print  "iOPBR is " + iOPBR + " | decimal is " + dec  + " | numeric is " + num 
End sub
Comment 4 Tom 2025-05-15 10:43:10 UTC
(In reply to mc from comment #3)
> Created attachment 200802 [details]
> test, macro correction
> 
> Hi, see correction of your macro. Problem is Macro
> 
> Global iOPBR as single
> Global sSQL as string
> 
> SUB ReadInfo
>    sSQL = "Select deci_mal, nume_ric from Tabella1"
>    oConnect=ThisDatabaseDocument.DataSource.getConnection("","")
>    oQuery=oConnect.CreateStatement()
>    oResult= oQuery.executeQuery(sSQL)
>    oResult.Next
>    iOPBR  = oResult.getdouble(1)
>    dec   = oResult.getstring(1)
>    num  = oResult.getstring(2)
>    print  "iOPBR is " + iOPBR + " | decimal is " + dec  + " | numeric is " +
> num 
> End sub

All clear now, thank you.