DisplayFormat

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Rober Watson
Posts: 7
Joined: Tue 02 Sep 2008 16:14

DisplayFormat

Post by Rober Watson » Tue 02 Dec 2008 20:32

Using myQuery and D2007.

Opening table when the app opens, using OnCreate event.
(Active:=TRUE;)

I have a "costs" field. I would like to specify the displayFormat so that it contains a $ .

How do I do this?? Prior to mySQL, I used XBase tables. I could cause the Fields objects to be created before run time and then set the DisplayFormat of the Fields. I don't know how to do this now with mySQL and Devart's myQuery object.

Thanks for any help,
Bob

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Wed 03 Dec 2008 13:04

You can create field objects in desing time using the "Fields Editor" pop-up menu of TMyTable or TMyQuery.

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: DisplayFormat

Post by eduardosic » Wed 03 Dec 2008 14:29

Rober Watson wrote:Using myQuery and D2007.

Opening table when the app opens, using OnCreate event.
(Active:=TRUE;)

I have a "costs" field. I would like to specify the displayFormat so that it contains a $ .

How do I do this?? Prior to mySQL, I used XBase tables. I could cause the Fields objects to be created before run time and then set the DisplayFormat of the Fields. I don't know how to do this now with mySQL and Devart's myQuery object.

Thanks for any help,
Bob
Try this

Code: Select all

TFloatField( MyQuery.FieldByName( 'Vl_Money' )).DisplayFormat := '#,##0.00';

Rober Watson
Posts: 7
Joined: Tue 02 Sep 2008 16:14

Post by Rober Watson » Wed 03 Dec 2008 18:27

Dimon wrote:You can create field objects in desing time using the "Fields Editor" pop-up menu of TMyTable or TMyQuery.

___________________

That is what I was trying to do, but it is
not clear to me how to do it. Can you
explain further please? Maybe "click by click".

Thanks,
Bob

Rober Watson
Posts: 7
Joined: Tue 02 Sep 2008 16:14

Re: DisplayFormat

Post by Rober Watson » Wed 03 Dec 2008 18:33

eduardosic wrote:
Rober Watson wrote:Using myQuery and D2007.

Opening table when the app opens, using OnCreate event.
(Active:=TRUE;)

I have a "costs" field. I would like to specify the displayFormat so that it contains a $ .

How do I do this?? Prior to mySQL, I used XBase tables. I could cause the Fields objects to be created before run time and then set the DisplayFormat of the Fields. I don't know how to do this now with mySQL and Devart's myQuery object.

Thanks for any help,
Bob
Try this

Code: Select all

TFloatField( MyQuery.FieldByName( 'Vl_Money' )).DisplayFormat := '#,##0.00';
_______________________________

Thanks - worked perfect.

I also did a
TFloatField( DM.myDefinedClasses.FieldByName( 'costs' )).currency := TRUE;

which had no affect (best I can tell). I thought currencey put the $-mark
Apparently not. I used a displayFormat of '$ #,##0.00' and it worked
fine. Thank you - Bob

eduardosic
Posts: 387
Joined: Fri 18 Nov 2005 00:26
Location: Brazil

Re: DisplayFormat

Post by eduardosic » Wed 03 Dec 2008 18:37

:) ok

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 04 Dec 2008 14:52

Rober Watson wrote:
Dimon wrote:You can create field objects in desing time using the "Fields Editor" pop-up menu of TMyTable or TMyQuery.
___________________

That is what I was trying to do, but it is
not clear to me how to do it. Can you
explain further please? Maybe "click by click".

Thanks,
Bob
- Drop the TMyQuery component on a form.
- Set the SQL property.
- Right-click on the component to open pop-up menu.
- Click on the "Fields Editor..." menu.
- Right-click in the open window to call the pop-up menu.
- Select "Add all fields" item.

After this you will be able to set the DisplayFormat property in desing time.

Post Reply