Home End User

Field Order in Report Wizard

edited April 2009 in End User
Hi

RB11.04Ent, Delphi 2007

The New Report Wizard presents the available fields in alphabetical order
and not the order of the fields specified in the Data tab. This
significantly slows down the process of report design. Any chance of the
the field order matching the column order. (This is how it used to be in
RB9)

Regards

Tim Murfitt

Comments

  • edited April 2009

    RB 10 and RB 11 have the field names sorted. I believe this was changed
    because many customers were complaining. Just goes to show you can never
    make everyone happy. :)

    To customize this behavior you can implement the TppDesigner.OnGetFields
    event.

    Or you can define a custom report wizard and register it with RB. Almost
    every form and wizard is replaceable.

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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2009
    Nard

    You should not have listened to them!

    It is not obvious to me what is possible with the OnGetFields event. The
    aFieldList seems to not do a lot. Could you give me a pointer to how I can
    use it to get the fields in the same order as the dataview. I dont really
    want to define custom report wizards if at all possible.

    Regards

    Tim Murfitt


  • edited April 2009

    You can write some code to load the fields into the list.

    Here is the default behavior, not the sort at the end...

    aFields.Clear;

    for liField := 0 to aDataPipeline.FieldCount - 1 do
    begin
    lField := aDataPipeline.Fields[liField];
    if lField.Selectable then
    aFields.AddObject(lField.FieldAlias, lField);
    end;

    if (aFields is TStringList) then
    TStringList(aFields).Sort;



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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2009
    Nard

    I see what you propose but how do I pick up the pipeline to get the field
    name. As you will see from the code below the pipeline name is passed but
    not the pipeline. Am I doing something wrong?


    procedure TFormReports.ppDesigner1GetFields(Sender: TObject;
    const aDataName: string; aFieldList: TStrings);
    var liField : Integer;
    lField : TppField;
    begin
    aFieldList.Clear;
    for liField := 0 to aDataNamePipeline.FieldCount - 1 do
    begin
    lField := aDataPipeline.Fields[liField];
    if lField.Selectable then
    aFieldList.AddObject(lField.FieldAlias, lField);
    end;
    end;




  • edited April 2009

    RB 11 has a TppReport.GetDataPipeline method

    lDataPipeline := myReport.GetDataPipeline[aDataName];


    Another approach is to use TppDataPipelineList to get a list of the
    available datapipelines.

    uses
    ppDB:

    var
    lPipelineList := TppDataPipelineList.Create(myReport);

    begin

    lPipeline := lPipelineList[aDataName];

    lPipelineList .Free;

    end;


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

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited April 2009
    Nard

    Thank you for your help. All sorted as required. For those that are
    interested this is the code I used:


    procedure TFormReports.ppDesigner1GetFields(Sender: TObject;
    const aDataName: string; aFieldList: TStrings);
    var i : Integer;
    lField : TppField;
    lDataPipeline : TppDataPipeline;
    begin
    lDataPipeline := repPlayer.GetDataPipeline(aDataName);
    aFieldList.Clear;
    for i := 0 to lDataPipeline.FieldCount - 1 do
    begin
    lField := lDataPipeline.Fields[i];
    if lField.Selectable then
    aFieldList.AddObject(lField.FieldAlias, lField);
    end;
    end;


This discussion has been closed.