Interview Questions

Monday, May 12, 2014

Based on division id filter in the Report and evey page get new Item in ax 2009

Based on division id filter:-
while select custTable group by FedDivisionId where                    
                                                        (((DivisionId)&&(custTable.DivisionId == DivisionId))||(!DivisionId))&&
                                                        (((SubDivId) && custTable.SubDivId == SubDivId ) ||(!SubDivId)) &&
                                                        (((SectionId1)&&(custTable.SectionId == SectionId1))||(!SectionId1))

 Report and next:-

 if(itemid &&  itemid!=vendPackingSlipTransGlobal.ItemId)
 {
    itemId = vendPackingSlipTransGlobal.ItemId;
    element.newPage();  
    i=0;
 }
 i++;
Image add in to the report use this :-
display Bitmap footerImage()
{
    return SysResource::getResourceNodeData(SysResource::getResourceNode(resourceStr(dhtml_right)));
}

static void AreaID(Args _args)
{
    dataarea    area;
    ;
    while select area
    {
        info(area.Id);
    }
}

static void BatchJobSchedule_NUmberSeqListDelete(Args _args)
{
    BatchHeader batHeader;
    BatchInfo batInfo;
    RunBaseBatch rbbTask;
    str sParmCaption = "Delete --- NumberSeqList";
    ;
    rbbTask = new NubersequenceList_delete();
     batInfo = rbbTask .batchInfo();
    batInfo .parmCaption(sParmCaption);

    batInfo .parmGroupId(" ");
    batHeader = BatchHeader ::construct();
    batHeader .addTask(rbbTask);
    batHeader .save();
    info(strFmt("'%1' batch has been scheduled.", sParmCaption));
}

static void customerReadExcel(Args _args)
{
    SysExcelApplication application;
    SysExcelWorkbooks workbooks;
    SysExcelWorkbook workbook;
    SysExcelWorksheets worksheets;
    SysExcelWorksheet worksheet;
    SysExcelCells cells;
    COMVariantType type;
    int row = 1,Counter;
    CustAccount Customeraccount;
    CustAccount MergedaccountCustomeraccount;
    str company;
    CustName Name;
    FileName filename;
    CustTable CustTableDelete;
    CustTable Custtable,Custtablelocal;
    SalesJournalAutoSummary autosummary,autosummarylocal;

    #avifiles
    SysOperationProgress simpleProgress=new SysOperationProgress();

    ;
    application = SysExcelApplication::construct();
    workbooks = application.workbooks();
    filename = "C:\\list1.xlsx";

    try
    {
        workbooks.open(filename);
    }
    catch (Exception::Error)
    {
        throw error("File cannot be opened.");
    }

    workbook = workbooks.item(1);
    worksheets = workbook.worksheets();
    worksheet = worksheets.itemFromNum(1);
    cells = worksheet.cells();
//
    startLengthyOperation();
    do
    {
        row++;
        Counter++;
        type = cells.item(row+1, 2).value().variantType();
    } while (type != COMVariantType::VT_EMPTY);
    endLengthyOperation();

    simpleProgress.setCaption("Progress bar example…");
    simpleProgress.setAnimation(#AviUpdate);
    simpleProgress.setTotal(Counter);
    row =1;
     startLengthyOperation();
    do
    {
        row++;
        Customeraccount = cells.item(row, 1).value().bStr();
        Name = cells.item(row, 2).value().bStr();
        MergedaccountCustomeraccount = cells.item(row, 3).value().bStr();
        company = cells.item(row, 4).value().bStr();
        ttsBegin;
        delete_from autosummary
              where autosummary.CustAccount == cells.item(row, 1).value().bStr();
        select firstOnly forUpdate  CustTableDelete
              where CustTableDelete.AccountNum == cells.item(row, 1).value().bStr();
        select firstOnly forUpdate  Custtable
              where Custtable.AccountNum == cells.item(row, 3).value().bStr();
        CustTableDelete.merge(Custtable);
        Custtable.doUpdate();
        CustTableDelete.doDelete();
        ttsCommit;
        simpleProgress.setText(strfmt("The value of i is %1", row));
        simpleProgress.setCount(row, 1);
    type = cells.item(row+1, 1).value().variantType();
    }
    while (type != COMVariantType::VT_EMPTY);
    endLengthyOperation();
    application.quit();
    info('hi');
}
static void LedgerTrans_For_Account(Args _args)
{
    LedgerTrans lt;
    ;
    select sum(AmountMST) from lt where lt.AccountNum == '30-11-84'
        && lt.TransDate >= str2date("01-01-2014",123)
        && lt.TransDate <= str2date("31-01-2014",123)
       &&  lt.TransDate >= mkdate(01,07,2012)
       &&  lt.TransDate <= mkdate(31,08,2012);
        && lt.Dimension[1] == '003';
        info(strfmt("%1",lt.AmountMST));

}

No comments:

Post a Comment