Tuesday, 21 July 2015

how to pass multiple query value from an container or table to query run.

1.create a method in a class

str fieldListRange(FieldName _fieldName, str _value)
{

    container c;
    int countNumber;
    str rangeValue;
    A_InventImport   A_InventImport   ;
    ;

    while select * from  A_InventImport  
    {
     // c = conins(c,A_InventImport   .itemid);
     c+= A_InventImport   .ItemId;
    }

   for (countNumber = 1; countNumber <= conLen(c); countNumber++)

    {

    if(rangeValue)

    {

    rangeValue +="||";
    }

    rangeValue +="(" + _fieldName + " = \"" + strLRTrim(any2str(conPeek(c, countNumber))) + "\")";
    }
    return rangeValue;
}



then call this method in run method

queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,Closed)).value(queryvalue(noyes::Yes));
        queryRun.query().dataSourceTable(tablenum(inventsum)).addRange(fieldnum(inventsum,itemid)).value((strFmt("(%1) || (%2 = %3)",
        this.fieldListRange(fieldStr(A_InventImport   , ItemId), parameter1),
        fieldStr(A_InventImport   , ItemId), SysQuery::valueEmptyString())));

declare parameter1  as a string in the run method.

No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...