ScheduleWithParams

Note: This page includes content based on the F1 documentation for Centura development. It may be partially converted to support APF development, but should be regarded to be of uncertain actuality. It is provided as is. Eventually, it should be replaced by documentation available from within Visual Studio.

SalNumber ScheduleWithParams( SalString nWhat,
                           SalString sMethodName,
                           cMessage Mandatory,
                           cMessage NonMandatory )

The ScheduleWithParams method does the same as Schedule with the difference that custom parameters can be set and initialized in the "Schedule Task Wizard" dialog, ignoring the predefined ones.

Parameters

Name Description
SalString nWhat METHOD_Inquire to inquire if target object is available, Const.METHOD_Execute to perform the actual action.
SalString sMethodName The method name of the Task
cMessage Mandatory List of all mandatory parameters that must contain a value when the Task is run.
cMessage NonMandatory List of all non mandatory parameters (if any)

Returns

When nWhat is Const.METHOD_Inquire: TRUE if the Task is available, FALSE otherwise
When nWhat is Const.METHOD_Execute: Schedule ID of the Scheduled Task that was created, 0 otherwise.

Comments

The value in the predefined parameters will be used if the parameters in not found among the ones provided by the Mandatory & NonMandatory variables.

Example

Function: UM_AnalyzeSchema
   Parameters
      Number: nWhat
   Local variables
      cMessage: Mandatory
      cMessage: NonMandatory
   Actions
      Call Mandatory.AddAttribute( 'METHOD', 'ESTIMATE' )
      Call NonMandatory.AddAttribute( 'ESTIMATE_PERCENT', '10' )
      Return TaskScheduler.ScheduleWithParams ( nWhat, 'DATABASE_SYS.EXECUTE_ANALYZE_SCHEMA__', Mandatory, NonMandatory )
C# coding sample
public new SalNumber UM_Schedule(SalNumber nWhat)
{
	#region Local Variables
	cMessage Parameters = new cMessage();
	cMessage Mandatory = new cMessage();
	cMessage NonMandatory = new cMessage();
	SalNumber nScheduleId = 0;
	SalArray<SalString> sParam = new SalArray<SalString>();
	#endregion
	
	#region Actions
	using (new SalContext(this))
	{
		switch (nWhat)
		{
			
			case Const.METHOD_Inquire:
				return 1;
			
			case Const.METHOD_Execute:
				Parameters.Unpack(SalString.FromHandle(Sal.SendMsg(hWndParamSheet, Const.AM_User, 1, 0))); // Encode
				Mandatory.Unpack(Parameters.FindAttribute("MANDATORY", Const.strNULL));
				NonMandatory.Unpack(Parameters.FindAttribute("NON_MANDATORY", Const.strNULL));
				nScheduleId = Var.TaskScheduler.ScheduleWithParams(Const.METHOD_Execute, sMethodName, Mandatory, NonMandatory);
				if (nScheduleId > 0) 
				{
					sParam[0] = nScheduleId.ToString(0);
					Int.AlertBoxWithParams(Const.__SCHEDULE_NotifySchedule, Const.CAPTION_Information, Const.INFO_Ok, sParam);
					return Sal.EndDialog(this, Sys.IDCANCEL);
				}
				return 0;
		}
	}
		return 0;
	#endregion
}