Quantcast
Channel: AX Developer Forum
Viewing all articles
Browse latest Browse all 9880

Filtering records according to the date range

$
0
0

Hi All,

Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4

I have designed a form similar to form design which is in ‘Ledger\Inquiries\Tax\India posted tax\Service tax\Service tax’. - form name “ServiceTaxInquiry_IN” .

The fields for the column of the form (i.e)The fields in the ' Available List' are taken form another table which is created by me.According tto he fields selected and the date range given the records are fetched form the"LedgerTrans table"

In this newly created form , the method ‘createQuery ‘ which used to filter the recs form the LedgerTrans table ,according to the ‘From date’ and ‘To date’(both dates should be specified mandatorily).

public QueryRun createQuery(FromDate _fromDate,  ToDate  _toDate)

{

    Query queryLoc = new Query();

    str         Qstr;

   queryBuildDataSource        qbds;

    LedgerTrans                 LedgerTrans;

    ;

   if (_fromDate&& _toDate)

    {

//        queryLoc.addDataSource(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans, TransDate)).value(strfmt('"%1".."%2"',_fromDate, _toDate));

       queryLoc.addDataSource(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans, TransDate)).value(queryRange(_fromDate,_toDate));

    }

    else

    {

       queryLoc.addDataSource(tablenum(LedgerTrans));

    }

    queryRun = new QueryRun(queryLoc);

  //   Actual Query Executed

   info(strfmt('Actual Query Executed'));

    qbds = queryLoc.addDataSource(tableNum(LedgerTrans));

   info(qbds.toString());

//   Actual Query Executed

    return queryRun;

}

 In this method the statement

        queryLoc.addDataSource(tablenum(LedgerTrans)).addRange(fieldnum(LedgerTrans, TransDate)).value(queryRange(_fromDate,_toDate));

returns nothing, because when I decoded the query which is executed. the query passed is “ SELECT * FROM LEDGERTRANS”

 

Please given me clue as where i am making mistake.

 

Regards,

Rajee.


Viewing all articles
Browse latest Browse all 9880

Trending Articles