
Hi everybody,
I am trying to query a table with a range based on a Date type field but the query does not find my record. I tried it with another type (Int64) and it is working.
I tried it with another table (TSTimeSheet) with a range based on a Date field(PeriodFrom) and it is not working neiher.
Do we have to make a specila manipulation when we are working with Date Type in a Query ?
Here is my complete Code.
static void Test1(Args _args)
{
Query q = new Query();
QueryRun qr;
QueryBuildDataSource qbds;
lmb_EmplTimeBankTable lmb_EmplTimeBankTable;
Fromdate tmpFromDate = 1\1\2011;
//HcmWorkerRecId workerId = 5637144672;
;
qbds = q.addDataSource(tableNum(lmb_EmplTimeBankTable));
//qbds.addRange(fieldNum(lmb_EmplTimeBankTable, YearFromDate)).value(queryvalue(tmpFromDate));
qbds.addRange(fieldNum(lmb_EmplTimeBankTable, worker)).value(queryvalue(WorkerId));
qr = new QueryRun(q);
while(qr.next())
{
lmb_EmplTimeBankTable = qr.get(tableNum(lmb_EmplTimeBankTable));
info(strfmt("Account Num: %1, Name: %2", lmb_EmplTimeBankTable.Worker, tmpFromDate));
}
}
Thanks
*This post is locked for comments
I have the same question (0)Use this if you want to add a date query range:
qbds.addRange(fieldNum(CustTable, CreatedDateTime)).value(date2StrUsr(tmpCreatedDate));
Kind regards.