Home DADE
New Blog Posts: Merging Reports - Part 1 and Part 2

NexusDb & Date

edited July 2007 in DADE
Hi,

RBPro 10.05
Nexus 2.07
Dade dated April 2006
Works great if design report and run.

If I save the report, with a filter on Date, but value not entered &
Autosearch set, when report is run,operator is prompted for the date.
Entering the date in the format that worked in design mode...I get this
error (abbreviated): Query Execution Failed: Error in statement: Type
Mismatch[$3CA1/15521].

Any ideas?

--
Best wishes,
David Wenham
Mountaintop Systems

Comments

  • edited July 2007
    Take a look at the following article.

    -------------------------------------------------
    Tech Tip: Date formats used by DADE
    -------------------------------------------------

    DADE handles in two phases:


    1. User entry

    This occurs when the user specifies a date using the Query tools or the
    AutoSearch dialog. DADE converts the date string entered by the user into a
    Delphi TDateTime value. The string entered by the user is converted using
    Delphi's StrToDateTime. By default Delphi's StrToDateTime relies on the date
    formatting variables for the current windows locale. These can be overridden
    by the developer. See Delphi online help for StrToDateTime for more
    information.


    2. SQL submitted to the server

    When generating the SQL to be submitted to the database server, DADE
    converts the TDateTime value from number 1 above, to a string using the
    Delphi's FormatDateTime function. The format string used to convert the
    TDateTime is specified by the TdaSession.GetSearchCriteriaDateFormat and
    TdaSession.GetSearchCriteriaTimeFormat functions. These are virtual methods
    which may be overridden by descendant TdaSession classes.

    Below are the default values returned.


    {------------------------------------------------------------------------------}
    { TdaSession.GetSearchCriteriaDateFormat }

    function TdaSession.GetSearchCriteriaDateFormat(aDatabaseType:
    TppDatabaseType; const aDatabaseName: String): String;
    begin

    {return a format usable by FormatDate}
    case aDatabaseType of

    dtMSAccess:
    Result := 'YYYY-MM-DD';

    dtMSSQLServer, dtSybaseASA, dtSybaseASE, dtOracle:
    Result := 'YYYY/MM/DD';

    dtAdvantage:
    Result := 'YYYY-MM-DD';

    else
    Result := 'MM/DD/YYYY';

    end;

    end; {function, GetSearchCriteriaDateFormat}

    {------------------------------------------------------------------------------}
    { TdaSession.GetSearchCriteriaTimeFormat }

    function TdaSession.GetSearchCriteriaTimeFormat(aDatabaseType:
    TppDatabaseType; const aDatabaseName: String): String;
    begin
    {return a format usable by FormatDateTime}
    case aDatabaseType of

    dtMSAccess:
    Result := 'HH::MM::SS';

    else
    Result := 'HH:MM:SS';
    end;

    end; {function, GetSearchCriteriaTimeFormat}



    Note: DADE augments the above with additional formatting delimiters for
    Oracle and MSAccess. See TdaSQL.ResolveCriteria located in
    RBuilder\Source\daSQL.pas for more information.


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2007
    Thanks Nico,

    The problem seems to be that when function TdaSQL.ResolveCriteria is run,
    the variable FDatabaseType = dtParadox, even though
    I set ppDesigner.DataSettings.DatabaseType = dtNexusDb.


    --
    Best wishes,
    David Wenham
    Mountaintop Systems

  • edited July 2007
    Hi David,

    Are you using the Nexus DB2 plugin located in the \RBuilder\Demos\End User
    Databases\Nexus\ directory? Looking at this code it looks like the database
    type is properly set in the TdanxSession.GetDatabaseType routine.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited July 2007
    Hi Nick,

    Still not working.

    I was using one from latest Nexus download. Seemed identical except for line
    equating dtnexusdb with dtother.. which I had bracketed out. It neverthless
    had this code:

    {------------------------------------------------------------------------------}
    function TdanxSession.GetDatabaseType(const aDatabaseName: string):
    TppDatabaseType;
    begin
    Result := dtNexusDB;
    end;

    Anyway, made sure I was using the report builder one this time...( dated
    2006-4-26).. removed all dcu files and renamed all other danexusdb.pas.
    recompiled and installed package again .

    Still an error and still has FDatabasetype = dtparadox when
    TdaSQL.ResolveCriteria is run

    --
    Best wishes,
    David Wenham
    Mountaintop Systems

  • edited July 2007
    Hi David,

    Be sure that the DataBaseType property of the Designer.DataSettings object
    is set to dtNexusDB and that the DataBase Type option in the Data Settings
    dialog of DADE is also set accordingly. It looks like this property is set
    to dtParadox in the NexusDB example by accident. I'll have this fixed for
    the next release.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Nico,

    It is resolved thanks.

    For your information, and any others, I believe that
    1) A lot of the problem was reports left over from RB 9.06 and Nexus 1
    2) Setting DataBase Type option in the Data Settings dialog of DADE to
    Nexus doesn't work, unless you add/remove a table as well.
    3) It is easier to just edit the .rtm file and change dtParadox to dtNexusDB
    4) We've written an executable that will make this change for every RTM file
    in a folder. If anyone emails me, I can send it to them.
    davidw@mtntop.com.au

    Best wishes,
    David Wenham



  • edited August 2007
    Hi David,

    Great! I'm glad you got it working.

    Thank you for offering to help others that may have this issue.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.