Counter in FastReport adds more than once, how to solve?

1

I have a very complex report on fastreport on a given page the structure is a MasterData - > DetailData and within this Detail you have the required components, everything works 100%, it happens that in a fxtMemo I need to put the number of the worksheet this will number in sequence each Detail sheet.

I did the following, in the code I created a global variable ContaPlanilha: integer = 0;

In frxMemo's BeforePrint I put: ContaPlanilha := ContaPlanilha +1;

In the text of frxMemo I put "Planilha número: [ContaPlanilha]"

It takes the value of the variable and puts it in the frxMemo as it should be, it happens that even having only 1 test record, the variable has the value set to 2 is as if it were passing twice in OnBeforePrint, but as said only 1 only record ...

I am using "Double Step" because it is a complex and precise report of some values of variables that are only available in this condition.

I think this "Double Step" is causing this problem, but how to create an incremental variable without that problem?

    
asked by anonymous 05.04.2018 / 17:43

1 answer

3

Friend, make use of if Engine.FinalPass before incrementing your variable, with it you can know if it is in the first or second step and consequently can increment its variable only once.

    
05.04.2018 / 22:20