Interview Questions

Friday, May 16, 2014

Report to display current record in the Form in ax 2009

Report à methods à initFromCaller
public void initFromCaller(Args _args)
{
    BiddingMainCostSheetTable     _BiddingMainCostSheetTable;
    BidServiceCostSheetTable _bidServiceCostSheetTable;
  //  BidSvcsBOQSectionTable _bidSvcsBOQSectionTable;
    QueryBuildDataSource    qbds;
    ;
    if (_args.caller())
    {
        if (! _args.record().RecId)
            throw error(strfmt("@SYS22338",funcname()));

        switch (_args.dataset())
        {
            case tablenum(BiddingMainCostSheetTable):
                _BiddingMainCostSheetTable  = _args.record();
                qbds = element.query().dataSourceTable(tablenum(BiddingMainCostSheetTable));
                qbds.clearRanges();
                SysQuery::findOrCreateRange(qbds, fieldnum(BiddingMainCostSheetTable, MainCostSheetId));

                if (_BiddingMainCostSheetTable.MainCostSheetId)
                {
                    SysQuery::findOrCreateRange(qbds, fieldnum(BiddingMainCostSheetTable, MainCostSheetId)).value(_BiddingMainCostSheetTable.MainCostSheetId);
                }
                break;
            case tablenum(BidServiceCostSheetTable):
                _bidServiceCostSheetTable = _args.record();
                qbds = element.query().dataSourceTable(tablenum(BiddingMainCostSheetTable));
                qbds.clearRanges();
                SysQuery::findOrCreateRange(qbds, fieldnum(BiddingMainCostSheetTable, MainCostSheetId));

                if (_bidServiceCostSheetTable.MainCostSheetId)
                {
                    SysQuery::findOrCreateRange(qbds, fieldnum(BiddingMainCostSheetTable, MainCostSheetId)).value(_bidServiceCostSheetTable.MainCostSheetId);
                }
                break;           
            default:
                throw error(strfmt("@SYS23396",funcname()));
        }
    }
}

No comments:

Post a Comment