Using SETVIEW with Time fields

I’m using a process that uses a Text string to set the view on a RecordRef. It’s been working fine without a hitch, but I’m having an issue using this method with tables that have fields of type Time. For example: Item Catalog Table has three fields: “No.”, “Date Updated”, “Time Updated” Here’s the code: txtView := ‘SORTING (Item No.) WHERE (Date Updated=FILTER(08/22/03),Time Updated=FILTER( 7:30:05 AM))’; refRec.SETVIEW(txtView); IF (refRec.FIND(’-’)) THEN … The code always results in a zero-count recordset. The view works when the Time field is left out. I’ve tried all the Time formats I can think of (’ 7:30:05 AM’, ‘7:30:05 AM’, ‘07:30:05 AM’, ‘073005’, etc.) to no avail. I’ve also tried the following without success: rCatalog.SETRANGE(“Date Update”, 082203D); rCatalog.SETRANGE(“Time Updated”, 073005T); MESSAGE(‘Count = %1’, rCatalog.COUNT); txtView := rCatalog.GETVIEW; CLEAR(rCatalog); rCatalog.SETVIEW(txtView); MESSAGE(‘Count = %1’, rCatalog.COUNT); The result is: Count = 7500 Count = 0 Any idea what gives? Thanks in advance for any help! Brad

Hi Brad, I think the problem is milliseconds. Try this view ‘SORTING (Item No.) WHERE (Date Updated=FILTER(08/22/03),Time Updated=FILTER( 7:30:05…7:30:05.999))’ Bjarne

Hi Brad, What I would suggest is to declare a time variable, assign to it the time that you want and then set the range using the variable. This way you let the system format it the way it needs to. Hope this helps, Cristi Nicola

Is the field “Time Updated” modified from an “outside” application (SQL)? Then perhaps this application may have a problem with the Navision timeformat.

Thanks for all of your input! Bjarne, you hit the nail right on the head. It was the milliseconds. I was unable to get your filter to work, but if I formatted the time variable as such: FORMAT(“Time Updated”, 0, 1) …it worked perfectly. What I wanted was a way to set a view on a RecordRef without necessarily knowing the contents or types of the fields I’m setting the view on. It looks like I’ll have to be more careful with time fields, as Navision doesn’t include milliseconds when using GETVIEW. I appreciate all the help! Brad