Share via


FormDataSource.init Method

Definition

Creates a data source query that is based on the data source properties.

public:
 override void init();
public override void init ();
override this.init : unit -> unit
Public Overrides Sub init ()

Remarks

This method is called when the form is opened. The query that is generated by the method is used to the load data so that it can be displayed in the form. The init method can be overridden on a form data source. Right-click the Methods node under the data source, point to Override Method, and then click init.

The following example overrides the init method on a data source to specify the sorting order for the data source.

public void init() 
{ 
    super(); 
    this.query().dataSourceTable( 
        tablenum(SysVersionControlTmpItem)).addSortField( 
            fieldnum(SysVersionControlTmpItem, VCSDate), 
        SortOrder::Descending); 
    this.query().dataSourceTable( 
        tablenum(SysVersionControlTmpItem)).addSortField( 
            fieldnum(SysVersionControlTmpItem, VCSTime), 
        SortOrder::Descending); 
    this.query().dataSourceTable( 
        tablenum(SysVersionControlTmpItem)).addSortField( 
            fieldnum(SysVersionControlTmpItem, ChangeNumber), 
        SortOrder::Ascending); 
}

Applies to