Using FieldsXXX Properties
|
1) | Select Query Forms page on IB_WISQL main window and type name for new Query Form (for instance "Employee"). Then click the New button and select it in the list after adding it. Then press the Launch button to start this new Query Form. First that you see is Tabbed Notebook with separate page for each property of the DataSet. It also includes toolbars with many options so that we can make some pages contain additional notebook.
|
| |
2) | Type on SQL page of SQL page: "SELECT * FROM EMPLOYEE" (without any brackets), then press Prepare Dataset button. In the bottom memo a "PLAN (EMPLOYEE NATURAL)" message appears. Great! Go to page Data and see result! Don't confuse, to see all data use Goto Last Row button on taskbar. Dependently of size your monitor you can see part of grid containing RAW data in default presentation. Let's try improving its view.
|
| |
3) | Go to FieldList page next to the SQL page and copy all available fields to clipboard for future use, then select Field Properties page. This page contains its own notebook opened on Alignment page, but we'll not use alphabetical order and start from DisplayLabel property.
|
Paste fields list on DisplayLabel page and type text like this:
| |
| |
EMP_NO= Employee #
| |
FIRST_NAME= First Name
| |
LAST_NAME= Last Name
| |
PHONE_EXT= Phone ext.
| |
HIRE_DATE= Hire Date
| |
DEPT_NO= Department
| |
JOB_CODE= Job Code
| |
JOB_GRADE= Job Grade
| |
JOB_COUNTRY= Job Country
| |
SALARY= Salary ($)
| |
FULL_NAME= Full Name
| |
| |
Note: No spaces between field name and "=" sign.
| |
4) | If you don't want change labels of some fields in view, delete these fields from list. Take look on Data page looks better doesn't it?
|
| |
5) | For more, let's change DisplayFormat for some fields: on DisplayFormat page type:
|
EMP_NO="#" ###
| |
PHONE_EXT=(000);0;*
| |
HIRE_DATE=mm/dd/yyyy
| |
SALARY= # ### ### ##0.00
| |
Note: No spaces between field name and "=" sign.
| |
| |
Don't forget look on Data page. You can customize DisplayFormat property for other fields later and now go to Alignment page:
| |
| |
6) | Set Alignment property as follows:
|
EMP_NO=L
| |
FIRST_NAME=L
| |
LAST_NAME=L
| |
PHONE_EXT=L
| |
HIRE_DATE=C
| |
DEPT_NO=R
| |
JOB_CODE=L
| |
JOB_GRADE=C
| |
JOB_COUNTRY=L
| |
SALARY=R
| |
FULL_NAME=C
| |
Abbreviations means: L(eft), R(ight), C(entered). If no alignments assigned then the default settings are used.
| |
7) | Maybe the CharCase of some column doesn't satisfy your needs you can change it. In the CharCase property page type:
|
FIRST_NAME=P
| |
LAST_NAME=P
| |
JOB_CODE=N
| |
JOB_COUNTRY=U
| |
FULL_NAME=P
| |
Abbreviations means: P(roper), U(pper), L(ower), N(ormal). If no CharCase value is assigned then the default settings are used.
| |
8) | If you plan to edit selected data the EditMask property can help you do it more comfortably. Especially for the Date field type. For specifying EditMask property go to its page and type:
|
HIRE_DATE=00/00/0000
| |
MaskEdit property specification the same as for Delphi's MaskEdit controls.
| |
9) | To prevent occasionally changing important data such as SALARY we prevent editing in this column by setting ReadOnly property to T(rue):
|
SALARY=T
| |
Try editing this field. Your data is more safe then ever! You may need to add the FOR UPDATE clause to the end of the SELECT statement so that it is an updatable dataset. This is the same as setting RequestLive to true.
| |
10) | Next step we can do is hiding some fields from view WITHOUT SQL! On Visible property page type:
|
DEPT_NO=F
| |
SALARY=T
| |
JOB_GRADE=F
| |
Settings are T(rue) and F(alse) accordingly where true is the default setting. Second row is not necessary but easy to use when you decide hide this column in future.
| |
11) | Take a look at our data, all columns are displaying correctly but some columns are too wide and the fields order is incorrect. Don't worry, just resize and move columns as you wish right in the grid! Your changes will be shown in DisplayWidth and Index property pages.
|