| Stonefield Query SDK |
| DataEngine.GetCustomMetaData |
This script is called immediately after Stonefield Query loads the data dictionary from the REPMETA table into its DataEngine collections. So, you have full access to the in-memory data dictionary without altering the disk copy in REPMETA.
If you want to display an error message and terminate Stonefield Query (for example, if your script determines that something is wrong), set SQApplication.DataEngine.ErrorMessage to the desired message and return .F. from your script code.
Parameters
A reference to the Stonefield Query Application object.
Return Value
True if Stonefield Query can continue, False to terminate.
Example
Visual FoxPro
Here's an example that adds custom fields the user has added to their tables to the Stonefield Query data dictionary. It assumes there's a table called CUSTFLDS located in the directory specified in the Application object's TargetApplicationDirectory property that contains the necessary information. In this table, FIELDNAME contains the field name, FIELDTYPE contains the field type, FIELDLEN contains the field width, FIELDDEC contain the number of decimals, and FIELDHEAD contains the caption for the field.
lparameters toApplication as SQApplication local lnSelect, loField as Field, lcName lnSelect = select() select 0 use (toApplication.TargetApplicationDirectory + 'CUSTFLDS') scan lcName = trim(FIELDNAME) loField = toApplication.DataEngine.Fields.AddItem(lcName) loField.Type = FIELDTYPE loField.Length = FIELDLEN loField.Decimals = FIELDDEC loField.Caption = trim(FIELDHEAD) endscan use select (lnSelect) return .T.
VBScript
This example makes the EMPLOYEES and PAYROLL tables invisible to all but the ADMIN user.
function Main(Application)
dim Table
if Application.Users.UserName <> "ADMIN" then
set Table = Application.DataEngine.Tables.Item("EMPLOYEES")
Table.Reportable = False
set Table = Application.DataEngine.Tables.Item("PAYROLL")
Table.Reportable = False
end if
Main = True
end function JavaScript
This example makes the EMPLOYEES and PAYROLL tables invisible to all but the ADMIN user.
function Main(Application) {
var Table ;
if (Application.Users.UserName != 'ADMIN') {
Table = Application.DataEngine.Tables.Item('EMPLOYEES') ;
Table.Reportable = false ;
Table = Application.DataEngine.Tables.Item('PAYROLL') ;
Table.Reportable = false ;
}
return true ;
}See Also
DataEngine Object | Scripts
| Last Updated: 01/30/2008 |