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

FieldDisplay names not shown in Data-tab of report designer

edited April 2010 in General
When i start the ReportDesigner at runtime, and show the Data-tab it displays
all fields in the pipelines with their FieldDisplaynames
But when i switch to "Preview" and back again to "Data" the fields are
shown with their technical Fieldnames.

If it try to look at the FieldAlias of one of those fields in the SQL object,
it is correctly filled!
Their are some things happening when the report is run, coded by ourselves,
so we are probably messing something up ourselves,

Where can i find the code that creates the runtime representation of a pipeline
or dataview in the data-tab?

thanks

Comments

  • edited April 2010
    The TdaSQL object contains a list of SelectFields that contain TdaField
    items. These are used by TdaQueryDataView to create the pipeline fields.

    The unit daQueryDataView.pas, the method TdaQueryDataView.SQLToDataView has
    a loop like this...

    for liIndex := 0 to lSQL.SelectFieldCount - 1 do
    CreateField(lDataPipeline, lSQL.SelectFields[liIndex]);



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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2010
    Hello Nard,

    Thanks for the info.

    I was looking at the code of TdaQueryDataView.CreateField and notices something
    odd.

    [CODE]
    procedure TdaQueryDataView.CreateField(aDataPipeline: TppDataPipeline; aField:
    TdaField);
    var
    lField: TppField;
    begin

    {create field from field map}
    lField := TppField.Create(aDataPipeline);
    lField.Name := lField.GetValidName(lField);

    lField.DataType := aField.DataType;
    lField.DisplayFormat := aField.DisplayFormat;
    lField.DisplayWidth := aField.DisplayWidth;
    lField.FieldAlias := aField.Alias;
    lField.FieldLength := aField.FieldLength;
    lField.FieldName := aField.SQLFieldName;
    lField.IsDetail := aField.IsDetail;
    lField.Linkable := aField.Linkable;
    lField.TableName := aField.TableSQLAlias;
    lField.Searchable := aField.Searchable;
    lField.Selectable := aField.Selectable;
    lField.Sortable := aField.Sortable;

    lField.DataPipeline := aDataPipeline;

    end; {procedure, CreateField}
    [/CODE]

    lField.FieldAlias is set to aField.Alias and not to aField.FieldAlias what
    i would expect.
    Is there a reason for this, or is it a bug?

    greetings
    Bas
  • edited April 2010
    Hello Nard,

    Looking further in the code of TdaField, i see the comments mention the following:

    {@TdaField.Alias
    Defaults to the value of the FieldAlias. However, when the same field is
    added to the SQL multiple times a suffix is appended to differentiate the
    field.}

    But the property Alias doesnt do that, it just returns the FAlias value,
    in stead of defaulting to Fieldalias when this empty
  • edited April 2010
    That code has been in place for years and we have not had any reports of
    issues.

    If you think there is an issue, please create a simple example project using
    standard Delphi components and RB. Use the DBDemos data. Send in zip format
    to support@ and we can build and run it here.



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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2010
    Hello Nard,

    Sorry, but i don't have the time to create a a project reproducing this.
    It looks like in standard situations this works, but running Sync in my situation
    makes the Fieldaliases disappear. I've solved it by patching the RB code
    in daQueryDataview.CreateField.

    But looking at the source code in daSQL, you can at least conclude that the
    comments in the source code (lines 745 etc) don't match the source itself,
    like i stated in my post in this thread:

    in stead of defaulting to Fieldalias when this empty
This discussion has been closed.