Skip to main content

Report structure in AX 2009 / Create report in simple steps


public class ReportRun extends ObjectRun
{
 dialogField Fromdatefield,todatefield;
    FromDate fromdatevalue;
    ToDate   todatevalue;
    date1980 date1;
    date1980 date2;
    ConfirmId  ConfirmIdfield;

}

------------------------------------------------------------------------

display date1980 date2()
{
return date2;
}


------------------------------------------------------------------------

display date1980 date1()
{
return date1;
}



------------------------------------------------------------------------

public boolean getFromDialog()
{
    Boolean         ret;
   // LedgerPeriod    ledgerPeriod;
 //  CustConfirmTrans CustConfirmTrans;
    ;

    fromDateValue       = fromDateField.value();
    toDateValue         = toDateField.value();

    if (fromDateValue == dateNull())
    {
        select firstonly CustConfirmTrans;
        fromDateValue = CustConfirmTrans.ConfirmDate;//.PeriodStart;
    }
    if (toDateValue == dateNull())
    {
        todateValue = systemDateGet();
    }
    if (fromDateValue > toDateValue)
    {
        ret = checkFailed('From date should not be greater than To date.');
    }
    else
    {
        ret = true;
    }

    return ret;
}
--------------------------------------------------------------------------

public Object dialog(Object d)
{

    DialogRunbase dialog = d ;
    ;

    fromDateField           = dialog.addField(typeid(FromDate),"From date");
    toDateField             = dialog.addField(typeid(ToDate),"To date");

    return dialog;
}


------------------------------------------------------------------------

public boolean fetch()
{
    boolean ret;
   
    ;
    date1 = fromdatevalue;
    date2 = todatevalue; 



while select CustConfirmTrans where     CustConfirmTrans.ConfirmDate >= fromdatevalue
&& CustConfirmTrans.ConfirmDate <= todatevalue
{
      this.send(CustConfirmTrans);
}   


 ret = true; //super();
 return ret;
}

Comments