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

Updating dataview calc field unhooks any dbText fields

edited October 2004 in DADE
RB7.04 D6 Dade EUR SQL Server

Step 1) create a calc column of say Left(cut.name, 5) and then use it
in a dbText field
Step 2) modify field to be Left(cut.name, 10)

This unhooks the dbText field and you have to manually find it and
re-assign the field. Even if you had renamed the calc field it is
unhooked. Because the SQL alias changes?

Is this intentional? Can it be changed? How could I go about
changing it?

Thanks,
Rick Matthews
Dartek Systems Inc.

Comments

  • edited October 2004

    I don't know of any way around that. The underlying field name (the SQL
    alias) is changing and that is causing different fieldnames to be created.
    The FieldAlias displayed in the designer always maps to the fieldname and
    the DBText.DataField contains the fieldname value.

    You can check out TdaQueryDataView.CreateField located in
    daQueryDataView.pas to see where the fields get created.

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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2004
    Nard,

    I see the problem. As a compromise, if the user sets the Alias (which
    doesn't then change) of the calc field can I use it to hook back up
    the components that referred to the now renamed SQL alias?

    In TdaQueryDataView.SQLToDataView is it reasonable / safe to ripple
    through the report looking for unhooked field components and hooking
    them back up if I can find the FieldAlias? If so I think I need the
    DataPipeline calcfields from before the updated dataview. Is there an
    easy way to copy a pipeline?

    Any hints or code snippets would be greatly appreciated.

    Thanks,

  • edited October 2004

    You can try doing that. I do not know how safe it is, I cannot think of any
    issues off the top of my head. To copy the pipeline fields, try creating a
    pipeline and then loop thru the original pipeline fields and change the
    DataPipeline (i.e. parent).

    mySavePipeline := TppDBPipeline.Create(myPipeline.Owner);

    for liIndex := myPipeline.FieldCount-1 downto 0 do
    myPipeline.Fields[liIndex].DataPipeline := mySavePipeline;



    --
    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 was just what I was looking for. No guarantees of
    safety I know.

    Cheers,

This discussion has been closed.