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

Long calculated alias in Informix

edited November 2003 in End User
I'm using ReportBuilder vs Informix Dynamic Server 7.3, which allows only 18
characters for object names (tables, fields, variables etc.)

When I use the Query Builder and set up a SUM I get an AS expressionf formed
with the operation (SUM_) plus the table name plus the field like:

SUM(myfield) as SUM_MyTable_MyField

which most of the times generates error messages because of the length of
the identifier. One workaround is modify the SQL but it disallows futher use
of the builder.

Any suggestion ?

Thanks again,

Eduardo Martinez

Comments

  • edited November 2003

    This is controlled by the GetMaxFieldAliasLength method defined by the
    TdaDataSet class (ppDB.pas). This class is an abstract ancestor and the
    function is virtual so that it can be overridden by descendants. The default
    value is 25.

    In a prior post you mentioned using ADO, thus you will need to modify the
    TdaADODataSet defined in daADO.pas to override this function and return 18.

    If you need to recompile the package, the name is rbADO7x.dpk where the X is
    the version of Delphi you are using. Recompile the package and copy the .bpl
    to Windows system (or system32 if applicable). Copy the .dcp to
    RBuilder\Lib.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    First of all thanks againg for your answers, and I apologize for the delay,
    I've been a little busy this week with other work.

    A little observation, the class TdaDataSet is defined in daDB.pas not in
    ppDB.pas, it's ok, I'd get confused too with so many similar names.

    I overrided it at the daADO.pas but I can't find any rbADO77.dpk in
    RBuilder\Sources (in fact anywhere below \Borland\Delphi7). Is it missing
    from my installation? what can I do?

    Thanks again and best regards

    Eduardo Martinez



  • edited November 2003

    Please send an e-mail request to support@digital-metaphors.com and we can
    send you the package source.


    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited November 2003
    I received your e-mail with the package and compiled succesfully but I still
    have the problem

    I made the next modification to daADO.pas (I have not much expierience
    modifying classes)

    First the class:

    TdaADODataSet = class(TdaDataSet)
    private
    FQuery: TADOQuery;
    FADOConnection: TADOConnection;

    function GetQuery: TADOQuery;

    protected
    procedure BuildFieldList; override;
    function GetActive: Boolean; override;
    procedure SetActive(Value: Boolean); override;
    procedure SetDatabase(aDatabase: TComponent); override;
    procedure SetDataName(const aDataName: String); override;

    property Query: TADOQuery read GetQuery;

    public
    constructor Create(aOwner: TComponent); override;
    destructor Destroy; override;

    class function ClassDescription: String; override;

    procedure GetFieldNamesForSQL(aList: TStrings; aSQL: TStrings);
    override;
    procedure GetFieldsForSQL(aList: TList; aSQL: TStrings); override;
    {modificado por Eduardo Martinez para Informix}
    function GetMaxFieldAliasLength: Integer; override;
    {-------->}

    Then the function itself

    { TdaADODataSet.GetMaxFieldAliasLength
    Modificado por Eduardo Martinez para Informix de 25 a 18}

    function TdaADODataSet.GetMaxFieldAliasLength: Integer;
    begin
    {Result := 25;}
    Result := 18;
    end; {function, GetMaxFieldAliasLength}

    Am I misiing something

    Best regards

    Eduardo Martinez
  • edited November 2003

    No that should work.

    Delete all versions of daADO.dcu on your machine. The copy daADO.pas to
    RBuilder\Lib, point your Delphi library to RBuilder\Lib and recompile your
    Delphi project. Put a break point on that line of code to make sure that it
    is being called.

    If the run-time test above works, then you are ready to rebuild the
    rbADO77.dpk. After building the package quite out of Delphi and delete
    rbADO77.bpl from Windows\System (System32). Then copy the new .bpl (check
    the file datetime) to Windows\System and restart Delphi.




    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.