Share via


JmgCleanupTermReg.initQueryRun Method [AX 2012]

Initializes the QueryRun object, which is used to fetch the records to be cleaned up.

Syntax

protected abstract QueryRun initQueryRun()

Run On

Called

Return Value

Type: QueryRun Class
A QueryRun object that references the records to be cleaned up.

Remarks

This method is declared abstract. It should return a QueryRun object that has a query that contains one data source, which can be mapped to the JmgTermRegArchiveMap map.

Examples

The following example demonstrates the use of this method.

public void run() 
{ 
    QueryRun qr; 
    #AviFiles 
 
    super(); 
    ttsbegin; 
    startLengthyOperation(); 
 
    qr = this.initQueryRun(); 
    this.progressInit("@SYS39821", SysQuery::countTotal(qr), #AviFileMove); 
 
    switch (cleanupMode) 
    { 
        case JmgTermRegCleanupMode::ToTable: 
            this.archiveToTable(qr); 
            break; 
        case JmgTermRegCleanupMode::ToFile: 
            this.archiveToFile(qr); 
            break; 
        case JmgTermRegCleanupMode::Delete: 
            this.delete(qr); 
            break; 
    } 
    endLengthyOperation(); 
    ttscommit; 
 
    if (caller) 
    { 
        caller.dataSource().research(); 
    } 
}

See Also

Reference

JmgCleanupTermReg Class