FormDataSource.init Method [AX 2012]

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

public void init()

Run On

Client

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); 
}

Community Additions

ADD
Show: