1 (edited by teco049 2017-02-09 14:01:12)

Topic: POSSIBLE BUG: TableGrid, Date, Float and some questions

Hello,
I have some questions, hopefully no problems...
.
Table Grid:
Date are not shown. I have checked the database. The date is stored as dd.mm.yyyy and not as dd.mm.yyyy hh.mm.ss.xxx. I am using sql statements for storing dates like

update entries set date = datetostr(form1.datetimepicker.datetime)

Anything missing here?
.
Float:
I am located in germany. We have no decimal dot we have decimal comma. Our amounts are shown as
1,98
1.234,98
and not
1.98
1,234.98
calculations does not work with sql statements. When I use

select sum(value) from entries 

and I have a lot of values like
1,29; 0,69; 5,63
Only the part before the comma is calculated and the table grid does not show larger amounts, which are written 1.234,98...
Is there any automatic conversation possible to change the , with . and the . with ,
When I use

replacestr('1.234,98', ',' ,'.')

I get 1.234.98 which I can not convert to 1,234.98.
.
Any solutions/ideas?
.
Thank you.
.
Project not attached, because it is written with german dialog text...

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

Found some solutions for me and a possible bug.
.
Scripting engine:
After all procedures/functions

begin
  Form1.TableGrid1.dbUpdate;
  Form1.Edit1.Text :=sqlexecute('select sum(income) from accounting');
  Form1.Edit2.Text :=sqlexecute('select sum(expenses) from accounting');

end.

Result: Application crash.

Error Message attached.

Software: MyVisualDatabse 3.2

Post's attachments

Attachment icon Possiblebug.png 20.36 kb, 234 downloads since 2017-02-09 

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

Hello.

Date are not shown. I have checked the database. The date is stored as dd.mm.yyyy and not as dd.mm.yyyy hh.mm.ss.xxx. I am using sql statements for storing dates like

Valid query to store date

SQLExecute('update entries set date = "'+FormatDateTime('yyyy-MM-DD hh:nn:ss.000', form1.datetimepicker.datetime)+'"' ); 



Float:
I am located in germany. We have no decimal dot we have decimal comma. Our amounts are shown as
1,98
1.234,98
and not
1.98
1,234.98
calculations does not work with sql statements. When I use

Please attach your project.



Scripting engine:
After all procedures/functions

Between

begin 
...
end. 

you can't do any actions related with database, you should use event OnShow of main form for that.

Dmitry.

4 (edited by teco049 2017-02-10 12:43:31)

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

Dimitry,
Thank you for the information. I have do some changings and it works at the moment.
The project is attached. Maybe you find something I can do better.
Project is in german language.
Thank you.

Post's attachments

Attachment icon Kassenbuch_001.zip 25.75 kb, 448 downloads since 2017-02-10 

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

I see that you use script for all database operation (Update/Insert), usually there is no need to use script for that, more easy way to use buttons with action "New Record", "Show Record", "Save Record" etc.  I can recommend for you video lessons:
http://myvisualdatabase.com/video_lessons.html



But if you use SQL, some tips:

To store INTEGER values, set property NumbersOnly=True for component kassenbuch.edit4, then you can use script

kassenbuch.edit4.sqlValue

instead

replacestr(kassenbuch.edit4.text,',','.')


to store date

Kassenbuch.DateTimePicker1.sqlDate

instead

formatdatetime('yyyy-mm-dd',Kassenbuch.DateTimePicker1.DateTime)
Dmitry.

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

DriveSoft wrote:

I see that you use script for all database operation (Update/Insert), usually there is no need to use script for that, more easy way to use buttons with action "New Record", "Show Record", "Save Record" etc.  I can recommend for you video lessons:
http://myvisualdatabase.com/video_lessons.html



But if you use SQL, some tips:

To store INTEGER values, set property NumbersOnly=True for component kassenbuch.edit4, then you can use script

kassenbuch.edit4.sqlValue

instead

replacestr(kassenbuch.edit4.text,',','.')


to store date

Kassenbuch.DateTimePicker1.sqlDate

instead

formatdatetime('yyyy-mm-dd',Kassenbuch.DateTimePicker1.DateTime)

Dimitry,
Thank you for the information and help.
I was in need to use for insert/update SQL Statements instead of the actions because I haven't found a way to calculate and add the hash value at the same time when I insert or update to the database.
Thank you.

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

teco049 wrote:
DriveSoft wrote:

I see that you use script for all database operation (Update/Insert), usually there is no need to use script for that, more easy way to use buttons with action "New Record", "Show Record", "Save Record" etc.  I can recommend for you video lessons:
http://myvisualdatabase.com/video_lessons.html



But if you use SQL, some tips:

To store INTEGER values, set property NumbersOnly=True for component kassenbuch.edit4, then you can use script

kassenbuch.edit4.sqlValue

instead

replacestr(kassenbuch.edit4.text,',','.')


to store date

Kassenbuch.DateTimePicker1.sqlDate

instead

formatdatetime('yyyy-mm-dd',Kassenbuch.DateTimePicker1.DateTime)

Dimitry,
Thank you for the information and help.
I was in need to use for insert/update SQL Statements instead of the actions because I haven't found a way to calculate and add the hash value at the same time when I insert or update to the database.
Thank you.

Using event OnClick of button with action "Save Record" you can calculate values in components before record save.
And another way to calculate, example: http://myvisualdatabase.com/forum/viewtopic.php?id=1416

Dmitry.

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

I am not managing to carve a textbox he was seeing sql with insert. In properties it was defined that the only accepted textbox numbers, which it has 2 decimal houses and which the separation takes as a thousand. I tried already with replace, floattostr (textbox) etc. and without success. Can anybody help?

I am using the MVD 3.1

Roberto Alencar

Re: POSSIBLE BUG: TableGrid, Date, Float and some questions

Please attach your project.

Dmitry.