Page 1 of 1

DisplayFormat

Posted: Tue 02 Dec 2008 20:32
by Rober Watson
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

Posted: Wed 03 Dec 2008 13:04
by Dimon
You can create field objects in desing time using the "Fields Editor" pop-up menu of TMyTable or TMyQuery.

Re: DisplayFormat

Posted: Wed 03 Dec 2008 14:29
by eduardosic
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';

Posted: Wed 03 Dec 2008 18:27
by Rober Watson
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

Re: DisplayFormat

Posted: Wed 03 Dec 2008 18:33
by Rober Watson
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

Re: DisplayFormat

Posted: Wed 03 Dec 2008 18:37
by eduardosic
:) ok

Posted: Thu 04 Dec 2008 14:52
by Dimon
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.