Scripting

edited 8:02PM in FastReport 2.xx VCL
Is it possible to have one master band and several detail bands (all having datasources set up with the datasource of the master band as mastersource ), and then supress printing of each detail band based on some contents of the master?

I want only 1 of the detail bands to be printed for each master-record.

Say I have a field in the master datasource containing values from 1 to 5.
I want detailband1 to be printed if the value is 1, detailband2 to be printed if the values is 2 and so on...

The fields of the detailbands I want to suppress will not necessarily be empty.

I have tried som scripting in the obp on both the master band and the detail bands, but with no success. (detailband1.visible and showband-function).

Comments

  • edited 8:02PM
    Try use of one detail band and modify the datafield reference in the memo on the band. This modification should be taken in the detailband's obp based on any condition you set up. The master datasource - of course - can have multiple detail data source set up with the details' datasource property. When a condition is true you can simply change the field reference in the desired memo. (Ie. from DetailSet1."fieldname" to DetailSet3."fieldname", etc.)

    Alex
  • gordkgordk St.Catherines On. Canada.
    edited 8:02PM
    yes it can
    work in the obp event of the masterdataband and set the visible property of the detailBands to true or false according to expression.
    if [tablename."fieldname"] > value then bandname.visible := true else bandname.visible := false;

    or create variables
    showd1 showd2 showd3
    set them to true or false according to expression in obp event of mdband.
    then in the obp event of the appropriate detailband
    visible := Showd1;
    and so on.
    regards ;)

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.