RTC Filter inaccuracy on Datetime Fields

andreaskellerandreaskeller Member Posts: 11
edited 2014-04-15 in NAV Three Tier
Hi,

I found an inaccuracy when using SETFILTER on datetime fields. We have datetime fields accurate to the second. In a Page e.g. OnOpenPage I want to set the filter to one specific Record, e.g. '02/10/11 11:15:37 AM'. When the Page opens no records are displayed. The same on a Form works perfectly. Datetime fields accurate to the minute work in both scenarios.
On the OnOpenPage and OnOpenForm triggers following code is written:
SETFILTER(DateTimeField, '02/10/11 11:15:37 AM');

Has anybody made similar observations, some work around? Thanks.

Below is the code of the samples I used to demonstrate the problem:
OBJECT Table 61000 DateTime Inaccuracy Test Table
{
  OBJECT-PROPERTIES
  {
    Date=02/10/11;
    Time=11:51:20 AM;
    Version List=;
  }
  PROPERTIES
  {
  }
  FIELDS
  {
    { 1   ;   ;Primary Key         ;Code10         }
    { 2   ;   ;DateTimeField       ;DateTime       }
  }
  KEYS
  {
    {    ;Primary Key                             ;Clustered=Yes }
  }
  FIELDGROUPS
  {
  }
  CODE
  {

    BEGIN
    END.
  }
}

OBJECT Form 61000 DateTime Inaccuracy Test Form
{
  OBJECT-PROPERTIES
  {
    Date=02/10/11;
    Time=12:02:22 PM;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    Width=9790;
    Height=6710;
    TableBoxID=1000000000;
    SourceTable=Table61000;
    OnOpenForm=BEGIN
                 SETFILTER(DateTimeField, '02/10/11 11:15:37 AM');
               END;

  }
  CONTROLS
  {
    { 1000000000;TableBox;220 ;220  ;9350 ;5500 ;HorzGlue=Both;
                                                 VertGlue=Both }
    { 1000000001;TextBox;0    ;0    ;2750 ;0    ;ParentControl=1000000000;
                                                 InColumn=Yes;
                                                 SourceExpr=DateTimeField }
    { 1000000002;Label  ;0    ;0    ;0    ;0    ;ParentControl=1000000001;
                                                 InColumnHeading=Yes }
    { 1000000003;CommandButton;2530;5940;2200;550;
                                                 HorzGlue=Right;
                                                 VertGlue=Bottom;
                                                 Default=Yes;
                                                 PushAction=LookupOK;
                                                 InvalidActionAppearance=Hide }
    { 1000000004;CommandButton;4950;5940;2200;550;
                                                 HorzGlue=Right;
                                                 VertGlue=Bottom;
                                                 Cancel=Yes;
                                                 PushAction=LookupCancel;
                                                 InvalidActionAppearance=Hide }
    { 1000000005;CommandButton;7370;5940;2200;550;
                                                 HorzGlue=Right;
                                                 VertGlue=Bottom;
                                                 PushAction=FormHelp }
  }
  CODE
  {

    BEGIN
    END.
  }
}

OBJECT Page 61000 DateTime Inaccuracy Test Page
{
  OBJECT-PROPERTIES
  {
    Date=02/10/11;
    Time=12:01:51 PM;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    SourceTable=Table61000;
    PageType=List;
    OnOpenPage=BEGIN
                 SETFILTER(DateTimeField, '02/10/11 11:15:37 AM');
               END;

  }
  CONTROLS
  {
    { 1000000000;0;Container;
                ContainerType=ContentArea }

    { 1000000001;1;Group  ;
                Name=Group;
                GroupType=Repeater }

    { 1000000002;2;Field  ;
                SourceExpr=DateTimeField }

  }
  CODE
  {

    BEGIN
    END.
  }
}

Comments

  • BeliasBelias Member Posts: 2,998
    you're right, it appears that nav filters only with the datetime filter excluding the seconds. neither this work :-k
    EVALUATE(datetimefilter,'10/02/11 13.13.13');
    SETRANGE(DateTimeField,datetimefilter);
    
    nav applies only this '10/02/11 13.13'
    i suggest you to search partnersource and/or ask microsoft
    P.S.: if you do a findfirst, it doesn't fail, thus, i think that it's half correct :shock:
    EVALUATE(datetimefilter,'10/02/11 13.13.13');
    SETRANGE(DateTimeField,datetimefilter);
    FINDFIRST;
    
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • andreaskellerandreaskeller Member Posts: 11
    Thanks for the reply. I thought I would need to contact Microsoft, but wanted to check here first.
  • babak2000irbabak2000ir Member Posts: 5
    Hello Guys, I'm facing this same problem with 2009r2. Did you finally managed to solve it?
Sign In or Register to comment.