Stonefield Query calls the Application.BeforeSetup script before the Stonefield Query window appears. There are a variety of uses for this script, including checking whether certain requirements are met before Stonefield Query can run.

Since most set up tasks haven't been completed, access to member objects of the Stonefield Query Application object (such as DataEngine) is very limited and will likely result in errors.

Unlike Application.AfterSetup, Application.BeforeSetup is called even if a report is run from the Windows command line or another application, so it might be a more suitable location for setup tasks.

Parameters
A reference to the Stonefield Query Application object.

Return Value
True if the application should continue, False if it should terminate.

Example
This example retrieves some information from the APP.INI file in the project directory and stores it in a new property of the Application object.

Visual FoxPro

lparameters toApplication as SQApplication
local lcType
lcType = toApplication.GetINIValue(toApplication.ProjectDirectory + ;
    'APP.INI', 'Settings', 'Type')
toApplication.AddProperty('Type', lcType)
return .T.

VBScript

function Main(Application)
Type = Application.GetINIValue(Application.ProjectDirectory + _
    "APP.INI", "Settings", "Type")
Application.AddProperty("Type", Type)
Main = True
end function

JavaScript

function Main(Application) {
var Type ;
Type = Application.GetINIValue(Application.ProjectDirectory + 
    'APP.INI', 'Settings', 'Type') ;
Application.AddProperty('Type', Type) ;
return true ;
}

C#

The method in this script must be named Application_BeforeSetup.

public static bool Application_BeforeSetup(SFQApplication sfqApplication)
{	
  string type = sfqApplication.GetINIValue(
    sfqApplication.ProjectDirectory + "APP.INI", "Settings", "Type");
  sfqApplication.AddProperty("Type", type);
	
  return true;
}

VB.NET

The method in this script must be named Application_BeforeSetup.

public shared function Application_BeforeSetup(
    sfqApplication as SFQApplication) as Boolean

  Dim Type as String = sfqApplication.GetINIValue(
    sfqApplication.ProjectDirectory + "APP.INI", _
    "Settings", "Type")
  sfqApplication.AddProperty("Type", Type)

  return true

End Function

See also

Application.AfterSetup | Application.Shutdown | Scripts

© Stonefield Software Inc., 2023 • Updated: 06/06/16
Comment or report problem with topic