Friday 2 November 2012

Parameter Passing

Te retrive multiple slected vaues  form class  when it is called thourgh menu item.


static void main(Args _args)
{
    // creating the object for the report
    SRSReportRun rr = new SRSReportRun("PurchaseOrders.PurchaseOrders");
    //Purchase RequestLine buffer
    PurchReqLine prl ;
    //used to store the values of PurchaseReqLine Table PurchReqTable Field Value
    Array ar = new Array(Types::Int64);
    // use to count the number of records
    int i;
    // used to store all purchaser order numbers
    str PurchId;


    //
    //modified by madhav
    // getting the first marked record from the called form
       prl = _args.multiSelectionContext().getFirst();
            i=1;
            while(prl)// if record exists
            {

                // assigning the PurReqTable field value to array
                ar.value(i,prl.PurchReqTable);
                // getting the next marked record form the caller form
                prl = _args.multiSelectionContext().getNext();
                i++;
            }

    PurchId ="";
    // used to get all the purchase order Numbers using the PurchReqLineTable
    for(i=1;i<=ar.lastIndex();i++)
    {
        select PurchId from prl where prl.PurchReqTable == ar.value(i);

        PurchId += prl.PurchId+",";

    }

    // generating the report;
    rr.init();
    rr.resetQueries();
    rr.showDialog(false);
    //setting the report parameter value;
    rr.currentQuery().dataSourceTable(tableNum(PurchTable)).addRange(fieldNum(PurchTable,PurchId)).value(PurchId);
    if(PurchId != "")
    {
    rr.run();
    }

 }

No comments:

Post a Comment