TfrBandView.SetPropValue

Hi

I'm getting an odd exception in my app using FastReports 2.51 (registered).

I'm creating and building a report at runtime. The first time round everything works fine. The second time round I get an exception in FR_Class.TfrBandView.SetPropValue.

Heres the key piece of code that raises the exception:
ABand := TfrBandView.Create;
ABand.SetBounds(0, 200, 0, 40);
ABand.BandType := btGroupHeader;
try
	ABand.Prop['CONDITION'] := '[' + FReportQuery.Name + '."' + FGroupField.FieldName + '"]';
except
	// To trap odd exception
end;
ABand.Name := 'GroupHeaderBand';
ABand.Master := 'MasterBand';
ABand.Prop['FormNewPage'] := 1;
APage.Objects.Add(ABand);

Debugging shows that the code drops into the section of SetPropValue that sets the DATASOURCE property as well as the CONDITION property.

As you can see I've added a try..except that hides the exception and allows the code to continue but its not pretty.

Any ideas\assistance would be welcome.


Comments

  • GreatDayDanGreatDayDan Keller, Texas
    edited 10:22AM
    Good Morning!

    Has an answer been found for this problem?

    I am also getting an AV but it is because in FR_Classes, in TfrBandView.SetPropValue(...
    ...
    else if Index = 'CONDITION' then
    begin
    GroupCondition := Value;
    if DocMode = dmPrinting then
    Parent.GroupCondition := Value
    end
    ...

    DocMode is back to dmPrinting and Parent is NIL!

    I am even explicitly creating and freeing a new report.

    Thanks...Dan'l


  • gordkgordk St.Catherines On. Canada.
    edited 10:22AM
    not sure what you mean by second time around.
    but before you start building
    call the clear methods of the report component
    ie frreport1.pages.clear;
    regards ;)
  • GreatDayDanGreatDayDan Keller, Texas
    edited 10:22AM
    Good Morning!

    That is already being done.

    I have a button on my form that builds the report. Using the same dataset, if I click the button a second time, then I get the error.

    I have added a try...except (as did Morlok) and that allows me to create a report more than once.

    I have posted part of the code to the VCL newsgroup in my "Group band does not show" post.

    Thanks...Dan'l

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.