Hi ,
First time posting here. Hope someone can help out.
I have a while select query which needs to find records based on the REQUEST_DELIVERY_TIME field of a View. The field is stored as a date in the AX DB (I have no control over this) and the method which does calls the select statement takes in a string as a date (again, I have zero control over this as I am creating an X++ Service to talk to an existing .Net application. I converted the string to a utcdatetime object (this same piece of logic is used in simlar methods quering very similar views where the equivalent REQUEST_DELIVERY_TIME field is actually a utcdatetime- again, I'm afriad i'm stuck with a date for this particular view).
There is a problem with the where clause of my while select as its not identifying the dates as equal.
For the purpose of this example, there is only 1 record in the view I'm querying...
I wrote a little piece of code and retrieved the date im loking for from DB (with the select first only statement below) and then debugged and compared it to the date object I got from converting the string passed into the method to utcdatetime and then to date.... and they are EQUAL!.... yet AX doesnt say they are equal at all in the ensuing while select ... I'm really stuck on this. Am I missing something to do with Time zones?
Thanks in advance for any help.
provider = System.Globalization.CultureInfo::get_CurrentCulture();
datePattern = 'yyyyMMddhhmmss';
dt = System.DateTime::ParseExact(time, datePattern, provider);
select firstonly * from openRequestVw;
temp = openRequestVw.REQUEST_DELIVERY_TIME;
temp1 = DateTimeUtil::date(dt);
if (temp == temp1)
{
print("hello"); // this code gets hit as the dates are equal
}
while select * from openRequestVw
where openRequestVw.HUB_NAME == hubName && openRequestVw.REQUEST_DELIVERY_TIME == DateTimeUtil::date(dt);
{
// do stuff here
}