How to Speed up DesignReport() call

First off, if you have any better solutions than what I'm doing, I am all ears.


I have a setup as follows:
Files->Tables->Data Objects

It's not a true database, but I want the users to be able to access the data as though it were one. So what I have done is create a UserDataSet for each Table, and populated it with a list of all the relevant Data objects. As well, while I want them to have access to all the Tables at all times, some setups will have more and less relevant Tables allowed. In those cases, I want to auto-populate the data-tree structure on the right hand side of the designer with the "expected most relevant tables."

The pseudo-code is as follows:

CustomReport->EnabledDataSets->BeginUpdate();
CustomReport->DataSets->BeginUpdate();
For all Tables:
TfrxUserDataSet* DS = new TfrxUserDataSet(this);
DS->Visible = true;
DS->Enabled = true;

For All Data Objects:
DS->Fields->AddObject( "Label", (TObject*) ftInteger (or relevant));

CustomReport->EnabledDataSets->Add( DS );

if (DS is expected to be used)
CustomReport->DataSets->Add(DS);

CustomReport->EnabledDataSets->EndUpdate();
CustomReport->DataSets->EndUpdate();

CustomReport->DesignReport(false);
CustomReport->Designer->UpdateDataTree();


However, with this setup, the command "CustomReport->DesignReport(false);" can take about 10 seconds to execute, even on a completely blank form. I was wondering what I could do to speed that up?

---
P.S. : DS->Fields->AddObject( "Label", (TObject*) ftInteger (or relevant)); doesn't seem to indicate to the designer what type of data object the field is. The designer always has the ".0" symbol. Is there a way to flag the type of data object between integer, float, and string?

Comments

  • gpigpi
    edited 11:35AM
    Modify frxDataTree.pas
    for i := 0 to DatasetsList.Count - 1 do
    begin
    if DatasetsList.Objects[i] is TfrxDataset then
    ds := TfrxDataSet(DatasetsList.Objects[i])
    else ds := nil;
    if ds = nil then continue;
    {try
    ds.GetFieldList(FieldsList);
    except
    end;}
    
    Node1 := DataTree.Items.AddChild(Root, FReport.GetAlias(ds));
    Node1.Data := ds;
    SetImageIndex(Node1, 72);
    
    {for j := 0 to FieldsList.Count - 1 do
    begin
    Node2 := DataTree.Items.AddChild(Node1, FieldsList[j]);
    Node2.Data := ds;
    ind := 54;
    case ds.FieldType[FieldsList[j]] of
    fftNumeric: ind := 104;
    fftString: ind := 102;
    fftBoolean: ind := 107;
    fftDateTime: ind := 106;
    end;
    SetImageIndex(Node2, ind);
    end;}
    end;
    

    to disable loading of field names in the FR Designer

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.