Problem: MasterDate with 3 columns

edited 10:41AM in FastReport 4.0
Hi, I have a problem with my report where I created a PageHeader and a Masterdata (see attached file Prova.fr3).

I have a MasterData with 3 columns linked to a query (named qopelegF1) that contains the following 15 elements:
??? A
??? B
??? C
??? D
??? E
??? F
??? G
??? H
??? I
??? L
??? M
??? N
??? O
??? P
??? Q

Inside the report I create a TStringList where I insert the following items:
- H
- A
- Z
- W
- F
- G
- Y
- X
- J

In the event of OnBeforePrint of MasterData, I control if the element is contained in the query list that I created. If there is, I put MasterData???s property Visible to True, otherwise I put it to False.
The code is:

var
lista_ope : TStringList;

procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
begin
if <qopelegF1."CODTAB"> <> null then
begin
if (lista_ope.indexof( <qopelegF1."CODTAB">) <> -1) then
MasterData1.visible := true
else
MasterData1.visible := false;
end;
end;


begin
lista_ope := TStringList.Create;
Lista_ope.Add('H');
Lista_ope.Add('A');
Lista_ope.Add('Z');
Lista_ope.Add('W');
Lista_ope.Add('F');
Lista_ope.Add('G');
Lista_ope.Add('Y');
Lista_ope.Add('X');
Lista_ope.Add('J');
end.

The layout contains empty columns, as below:

column1 column2 column3
ADD CNT -
- - COM
CVC

But I would like my layout is like this:

column1 column2 column3
ADD CNT COM
CVC

There is some property that I set on MasterData who not have contemplated?



Comments

  • gpigpi
    edited 10:41AM
    Try
    var        
           lista_ope : TStringList;                                        
           Y: extended;                              
    
      procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
         if (not (<Line>=1)) and (not MasterData1.Visible) then Engine.CurY := Y;    
         if <qopelegF1."CODTAB"> <> null then
          begin                   
             if (lista_ope.indexof( <qopelegF1."CODTAB">) <> -1) then
                MasterData1.visible := true
             else
                begin
                  Y := Engine.CurY;                                                                                 
                  MasterData1.visible := false;
                end;                        
          end;      
    end;
    
  • edited 10:41AM
    Ok I understand!
    But I thought to use the report properties and do not write the code.
    If instead of 3 columns, I use a column with the same procedures, the problem does not exist.
    Why?
  • gpigpi
    edited 10:41AM
    I think it's a bug in report engine. So use script as workaround
  • edited 10:41AM
    I also think the same! [img]style_emoticons/<#EMO_DIR#>/sad.gif" style="vertical-align:middle" emoid=":(" border="0" alt="sad.gif" /> However, THANKS![/img]

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.