Hey,
I have simple requirements i need to select records created greater than X date.
I am trying to do that via x query but i have a problem when i add a range value it becomes "1900-01-01T00:00:00" but value was setting diffrent than that date.
There is how i trying to do:
Query query; QueryRun queryRun; QueryBuildDataSource qbdsPurch,qbdsPurchLine; utcdatetime utcTime; str timestr; query = new Query(); qbdsPurch = query.addDataSource(tableNum(PurchTable)); qbdsPurchLine = qbdsPurch.addDataSource(tableNum(PurchLine)); qbdsPurchLine.joinMode(JoinMode::InnerJoin); qbdsPurchLine.addLink(fieldNum(PurchTable,PurchId),fieldNum(PurchLine, PurchId)); qbdsPurchLine.addSortField(fieldNum(PurchLine,PurchId)); qbdsPurch.addRange(fieldNum(PurchTable,PurchaseType)).value(enum2Str(PurchaseType::Purch)); qbdsPurch.addRange(fieldNum(PurchTable,PurchStatus)).value(enum2Str(PurchStatus::Backorder)); utcTime = DateTimeUtil::getToday(TimeZone::GMTPLUS0300ISTANBUL); timestr = DateTimeUtil::toStr(utcTime); qbdsPurch.addRange(fieldNum(PurchTable,CreatedDateTime)).value(strfmt(" >= %1",timestr));
i am watching values on debug and utcTime value is {09/15/2022 00:00:00}
timeStr > "2022-09-15T00:00:00"
and qbdsPurch > {SELECT * FROM PurchTable(PurchTable_1) WHERE ((PurchaseType = 3)) AND ((PurchStatus = 1)) AND ((createdDateTime = '1900-01-01T00:00:00')) JOIN * FROM PurchLine(PurchLine_1) ORDER BY PurchLine.PurchId ASC ON PurchTable.PurchId = PurchLine.PurchId}
Why this createdDateTime becomes equal to null ? Any helps
utcTime = DateTimeUtil::getToday(TimeZone::GMTPLUS0300ISTANBUL); qbdsPurch.addRange(fieldNum(PurchTable, CreatedDateTime)).value(queryRange(utcTime, DateTimeUtil::maxValue()));
Hi Ferhat.S,
Try the above code which will return data which is greater then X date.
Thanks,
Girish S.
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 290,524 Super User 2024 Season 2
Martin Dráb 228,493 Most Valuable Professional
nmaenpaa 101,148