Topic: value with 6 leading numbers after 0

Hello guys,

I have a table tblBOM (Bill of material) where I need to enter an article and the consumption.
I;ve selected the field quantity as type Real, but I have values of 0.00004 pieces which in my application (table grid) are shown as 4E-5.
When i open the record to edit it, the value 4E-5 us shown...so....how could I get the entire value as 0.00004?
i tried also to replace the dot (.) with comma (,), but then my shown value is zero.

thank you.
Best regards,
Alin

Best regards,
Alin

2 (edited by derek 2020-03-25 12:47:15)

Re: value with 6 leading numbers after 0

Hi Alin,
In your database structure, you could try redefining your consumption field from 'real' to 'currency' and specify  how many places after the decimal point you need (not sure how many you can go to).
As I understand it, a 'currency' field is actually just a 'real' field with formatting applied.
Derek.

Post's attachments

Attachment icon screenshot1.jpg 107.73 kb, 233 downloads since 2020-03-25 

Re: value with 6 leading numbers after 0

Hello Derek,

Thanks for your answer.
i changed the type of the field from real to currency and the issue is still there.
I've checked was has been saved in the database, and there the value is stored correctly so...perhaps the issue comes from the select statement  I have.
My form contain 2 table grid views, one is with the articles and when i click on one article, the second  table grid is populated with the right Bill of material.

My Select statement looks like this:

frmArticole.grdBOM.dbSQL := 'SELECT tblBom.id,BOMName,ArticleNo, ArticleName,Quantity,UmNo,  ' +
           ' Case Active when 1 then "Da" when 0 then "Nu" End, ' +
           ' Case Fixed when 1 then "Da" when 0 then "Nu" End ' +
           ' from tblBOM ' +
           'inner join tblArticol on tblBom.id_tblArticol1=tblArticol.id ' +
           'inner join tblBomType on tblBom.id_tblBomType=tblBomType.id ' +
           'inner join tblUm on tblBom.id_tblUM=tblUm.id ' +
           'where id_tblArticol= '+ frmArticole.txtCODID.text + ;
     frmArticole.grdBOM.dbListFieldsNames:='ID,Tip BOM, Nr. Articol, Nume Articol, Cantitate,UM, Activ? ,Fix?';
      frmArticole.grdBOM.dbSQLExecute;

How can I change the Quantity in the select statement to show me the right value?
Thank you.

Br,
Alin

Best regards,
Alin

Re: value with 6 leading numbers after 0

m.alin wrote:

Hello guys,

I have a table tblBOM (Bill of material) where I need to enter an article and the consumption.
I;ve selected the field quantity as type Real, but I have values of 0.00004 pieces which in my application (table grid) are shown as 4E-5.
When i open the record to edit it, the value 4E-5 us shown...so....how could I get the entire value as 0.00004?
i tried also to replace the dot (.) with comma (,), but then my shown value is zero.

thank you.
Best regards,
Alin


Please, download latest beta version, fixed
https://www.dropbox.com/s/vyne4lvinpjzl … a.zip?dl=0


Also set property NumberOnly = True for Edit component.

Dmitry.

Re: value with 6 leading numbers after 0

Hello Dmitry,

Now when I click to edit the record, the value is correctly shown in the field.
Still, in the table grid view, the value is wrongly shown.
Should I change something in the select statement or do I have to do something in the settings of the table grid view?

Thanks.
Alin

Best regards,
Alin

6 (edited by derek 2020-03-26 13:25:31)

Re: value with 6 leading numbers after 0

Hi Alin,
Sorry, I didn't realise you were using sqlquery to populate your tablegrid.
Try using printf in your sql query select statement (see the attached for a simple example (to 7 decimal places)).
With MVD6.4, both the tablegrid format and the relevant edit field should now display correctly.
Derek.

Post's attachments

Attachment icon malin.zip 336.06 kb, 513 downloads since 2020-03-26 

Re: value with 6 leading numbers after 0

Thank you Derek.
It's working.

Best regards,
Alin