Interview Questions

Wednesday, May 14, 2014

fetch method example in ax 2009 for beginners

fetch method example in ax 2009


public boolean fetch()
{
    boolean ret = true;
    ItemId     itemid1,itemId2;
    Int        num = 0;
    int        counter = 0;
    real       counter1 = 0.0;
    real       counter2 = 0.0; // added on 31 oct
    real       counter3 = 0.0; // added on 31 oct
    ;

   // ret = super();
   // Added by Somendra on date 31 Oct 2013//Ns...
    select sum(S3Weight) from _salesLine where _salesLine.SalesId ==  element.args().parm();
    {
      weightLocal= _salesLine.Weight;
    }
    //Ne... added by somendra  on 29 Oct 2013
    //Start..
    select reverse firstonly  custConfirmJour1 where custConfirmJour1.SalesId == SalesLine.SalesId;
    ConfirmId =custConfirmJour1.ConfirmDocNum;
     //End..
    SalesLine.SalesId =  element.args().parm();
    element.execute(3);
    while select WorkOrder where WorkOrder.SalesId == salesLine.SalesId
    {
        NoOfPices = WorkOrder.NoOfPices;
        sizeId    = WorkOrder.InventSizeId;
        itemName  = InventTable::find(WorkOrder.ItemId).ItemName;
        length    = InventSize::find(sizeId,WorkOrder.ItemId).Length;
        width     = InventSize::find(sizeId,WorkOrder.ItemId).Breadth;
        wastage   = WorkOrder.Wastage;
        i     = i+1;
        element.execute(1);

    }

    element.execute(4);
    while select salesLine order by  salesLine.ItemId where SalesLine.SalesId ==  element.args().parm()

    {
        itemId1 = salesLine.ItemId;

        if(ItemId2 && ItemId2 != ItemId1)
        {
            element.execute(6);
            element.execute(5);
            counter = 0 ;
            counter1 = 0.0;
            totalqty = 0;
            totalBomQty = 0.0;
            totalWeight =0.0;
            j = 0;
        }

        if(num == 0)
        {
            element.execute(5);
            num = num + 1;
        }

        length1 = InventDim::find(salesLine.InventDimId).lengh();
        width1  = InventDim::find(salesLine.InventDimId).bredth();
        bomqty  = salesLine.BOMQty;
        qty     = salesLine.NoOfPices;
        hole    = salesLine.Hole;
        cutOut  = salesLine.CutOut;
        cskHole = salesLine.CskHole;
        code1   = salesLine.Code1;
        remarks = salesLine.Remarks;
        weight  = salesLine.Weight;// Added by Somendra on date 31 Oct 2013
        itemId2 = ItemId1;
        totalqty += qty;
        counter  += 1;
        totalBomQty += bomqty;
        counter1  += 1;
        totalWeight +=weight;
        counter2  += 1;
         j = j+1;

        //dateRequested   = salesLine.ShippingDateRequested;
       //dateConfirmed   = salesLine.ShippingDateConfirmed;

        //code    = salesLine.Code;

        //element.send(salesLine);
        element.execute(2);
    }
    element.execute(6);
    return ret;
}

No comments:

Post a Comment