Thursday, 9 January 2014

Normal Report filter in ax 2009

public class ReportRun extends ObjectRun
{
    Table1  Table;
}

public void init()
{
    element.initFromArgs(element.args());
    super();
}

void initFromArgs(Args args)
{

    if (args && args.dataset())
    {
        switch(args.dataset())
        {
            case tablenum(Table1) :
                Table = args.record();
                break;

        }
     
    }
}

public boolean mustLoadSaveQuery()
{
    return false;
}

public Query initQuery(Query _query)
{
    //Query query;
    QueryBuildRange range;
    ;
    query = _query;


    if (Table)
    {
        range = query.dataSourceTable(tablenum(Table1)).findRange(fieldnum(Table1,Emplid));
        if (!range)
            range = query.dataSourceTable(tablenum(Table1)).addRange(fieldnum(Table1,Emplid));

        range.value(Table.Emplid);
    }
    return query;

}

-------------------------------Small change on the report -- through container-
public boolean fetch()
{
    boolean ret=true;
    int    i;
    container      _conValue;
    ;
    while select Custtable
    {
        i++;
        ca = conIns(conValue,i,custtable.AccountNum);
        if(i == 2)
        {
            _custa = conPeek(conValue,1);
            _custa1 = conPeek(conValue,2);
            this.execute(1);
            i=0;
        }
    }
    return ret;
}

No comments:

Post a Comment