Sw4   >   Sql   >   Meta-Data
Meta-data is information about the database tables and columns. The
is used to edit and view the meta-data.Meta-data is stored with each SQL class (schema or query class) and with each schema or query class column. The meta-data is stored in a row variable which is copied to the $userinfo property of the respect schema or query class, or the schema class column.
Much of what you need to know about meta-data is in tooltips of the various fields in the
Meta-data makes it possible to generate autoconfig list and edit windows. Meta-data makes it possible to synchronize the database to match the schema classes of your application. .There are several types of admin columns which you can specify in the meta-data.
All of the above admin columns are optional. You can use as many or as few of the above columns as suits your requirements. It is strongly recommended that you include an editnum column in all of your schema classes.
I tend to use the editnum, insby, insdatetime, modby, moddatetime columns in most of my servertables.
I use the active column for most my tables. If a record is no longer actively used (discontinued inventory items, terminated employees) the user can set active to false. Inactive records don't show up in lookup droplists until the user clicks the button. If an active column is in the schema class, the fethallwhere in the schema class meta-data defaults to WHERE tablename.Active = 1, thereby reducing the intial list of records in the list to active records only.
Shift+click on the active admin column for all of the selected lines. This saves the user from having to jump back and forth editing each individual record just make old records inactive.
button in any list window to fetch all of the records. If there is an column in the headed list you can select any of the records on the list and then right-click on the selected records in the list. A menu item will appear in the context menu. Selecting this item will toggle the value of theDevelopers can add their own custom meta-data within the StudioWorks framework. The meta-data for each class and each column has a special row variable column named custominforow. You can defined this row variable with up to 400 columns of additional meta-data and within those 400 columns you can row and list columns so the number of additional meta-data columns is very large.
You will notice in the
, within each meta-data tab, a tab strip in the window with a tab named . It is here that you can add your own custom meta-data fields.When you look at under the
tab you will see a subwindow with some instructions and a button. If you click the button StudioWorks will copy the subwindow window class from swBase4 to you main library. It will also copy the _listdef schema class used to define the custominforow to your main library.There are 2 separate window classes and 2 separate schema classes that you can copy to your main library.
Once the classes are in your main library you can modify them to suit whatever your heart desires.
You add a column to the applicable _listdef schema class, then add a matching label and field to the applicable window class.
After you close and reopen the
your revised window class should appear under applicable the tab and you should be able to enter meta-data. Be sure to test that your meta-data is actually saved.You can add columns and fields any time you like. Your custominforow is automatically redefined when you edit the meta-data and existing data is copied to the new row.
You can access your meta-data through the oSQLLists object what is instantiated by the lsts tvar.
If you want to get the custominforow for a SQL class you would do the following:
; Get the meta-data custominforow for the specified SQL class.
Do lsts.$retSQLClassCustomInfoRow(SQLClassName) Returns CustomInfoRow
If CustomInfoRow.$colcount=0
; An error occurred.
Calculate FlagOK as kFalse
Else
Calculate MetaDataValue as CustomInfoRow.colname
; Continue with your code.
End If
If you want to get the custominforow for a column you would do the following:
; Get the meta-data custominforow for the specified SQL class column.
Do lsts.$retSQLColCustomInfoRow(SQLClassName,ColName) Returns CustomInfoRow
If CustomInfoRow.$colcount=0
; An error occurred.
Calculate FlagOK as kFalse
Else
Calculate MetaDataValue as CustomInfoRow.colname
; Continue with your code.
End If