Thursday, 25 July 2013

Processreport() method without getparameters() method with 2 ranges:

Processreport() method without getparameters() method with 2 ranges:

[SysEntryPointAttribute(false)]
public void processReport()
{
    QueryRun queryRun;
    Query query;
    CustTable custTable;
    TestContractClass testContractClass;
    AccountNum accountNum;
    CustGroupId     custGroupId;
    QueryBuildDataSource queryBuildDataSource;
    QueryBuildRange queryBuildRange;
    query = this.parmQuery();
    TestContractClass = this.parmDataContract() as TestContractClass;
    accountNum = testContractClass.parmAccountNum();
    custGroupId = testContractClass.parmCustGroupId();
   
    // Add parameters to the query.
    queryBuildDataSource = query.dataSourceTable(tablenum(CustTable));
    if(accountNum)
      queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, AccountNum));
    if(custGroupId)
        queryBuildRange = queryBuildDataSource.findRange(fieldnum(CustTable, custGroup));
    if (!queryBuildRange)
    {
    queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, AccountNum));
        queryBuildRange = queryBuildDataSource.addRange(fieldnum(CustTable, custGroup));
    }
    // If an account number has not been set, then use the parameter value to set it.
    if(!queryBuildRange.value())
    {
    queryBuildRange.value(accountNum);
    queryBuildRange.value(custGroupId);
    }
   
    queryRun = new QueryRun(query);
    while(queryRun.next())
    {
    custTable = queryRun.get(tableNum(CustTable));
    this.insertTmpTable(CustTable);
    }

}

No comments:

Post a Comment