Home DADE

Dade expression calculation data type

edited October 2004 in DADE
RB7.04 D6 Dade with report explorer and dictionary - Sybase and SQL
Server

When I create a calculation of type expression it appears to take the
data type of the field used to initially create the calculation. A
few questions:

1) Is this true?

2) How do you create say a datetime if your table doesn't already have
a field of this type?

3) When I first create a string calculation based on a date column
-say DateName(getdate()) - the dataview and the data tree both display
a type of String (what I want). If I put the field on the report and
preview it displays blank and from then on the type is displayed as
Date. How is the type first determined for the data tree and can I
make it stick? A preview from the data tab shows the string value.

Thanks,
Rick Matthews
Dartek Systems Inc.

Comments

  • edited October 2004

    Try using a the SQL Cast function to convert to the type that you need.

    This more of a database to TDataSet type of operation. RB is leveraging
    Delphi to get the field info. RB uses the TDataSet component (for BDE, it
    uses TQuery, for ADO it uses TADOQuery) to submit the SQL statement to the
    database. The Query component creates Field objects and RB reads these to
    get the field datatype info.





    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Thanks Nard, I went back to an end user demo running off a Sybase db
    and it all works great.

    So it looks like I have broken something with some of my
    customization. The symptom is that after the dataview is created it
    gets its type from the field datatype correctly, but that after
    previewing the report and returning to the designer the type has
    changed to the type of the underlying field.

    Where is my best bet to place some breakpoints to see where the
    datatype that is displayed in the datatree is being changed/set?

    Thanks,

  • edited October 2004

    This a tough question, partially because I do not know what type of changes
    you have made.

    A good place to start would be the DADE plug-in that are using. I am
    guessing that you using the BDE plug-in, which is defined in daDBBde.pas.

    1. The method TdaBDEDataSet.GetFieldsForSQL creates the TppField fields
    objects from the TQuery field objects that are created by the query object.

    2. The method TdaBDEQueryDataView.Init creates the datapipeline and sets
    DataPipeline.AutoCreateFields to False. Make sure that AutoCreateFields is
    being set to false.




    --
    Nard Moseley
    Digital Metaphors Corporation
    www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Thanks Nard, that got me going and I found my issue.

    Cheers,

This discussion has been closed.