Friday, August 9, 2013

How to Filter a Table with two Date Field

Below the code to filter a Table that have two date field and one only Filter Date :


    SysQuery::findOrCreateRange(Tablename_ds.queryBuildDataSource(),

                       fieldNum(Tablename, Fromdate)).

                       value( strFmt("(((%1==%2) || (%1<=%3) ) && ((%4==%2) || (%4>=%3))) || (%3==%2)",

                        fieldStr(Tablename, fromDate),

                        Date2StrXpp(DateNull()),

                        Date2StrXpp(FilterDate.dateValue()),

                        fieldStr(Tablename, toDate) ));  

Enjoy !