1

Topic: FastReport 3.18, SUM in IIF

Kind time of days!
There is a problem with function SUM. Rummaged an Internet - all councils which found to me did not approach!
Prompt who can knows...?
There is a report, in it in MasterData there is some field BDEQuery1. "SUMA".
For subdividing with the code 01 I need to enumerate this  proceeding from value
SUM (<BDEQuery1. "SUMA">).
The code for object memo the such:

[IIF (<BDEQuery1. "ID_DEPARTMENT"> = ' 01 ';
SUM (<BDEQuery1. "SUMA">, MasterData1);
<BDEQuery1. "SUMA">)]

For all departments normally deduces , and for 01 - it is empty also any errors!
Prompt, , what I do not so????

2

Re: FastReport 3.18, SUM in IIF

Derkach wrote:

Prompt, , what I do not so????

If I correctly understood - all.
At first, whether it is necessary to include field value <BDEQuery1. "SUMA"> for subdividing with the code 01 in a required total sum? (Well it so to speculation)
Further:
Do  the report
In a cellar of the data do invisible  with  the totals

 [SUM (<BDEQuery1. "SUMA">)] 

Field with the total

 [IIF (<BDEQuery1. "ID_DEPARTMENT"> = ' 01 ';
[MySum];
<BDEQuery1. "SUMA">] 

In the code

 var
MySum: Float;
procedure Footer1OnAfterPrint (Sender: TfrxComponent);
begin
MySum: = SUM (<BDEQuery1. "SUMA">);
end; 

3

Re: FastReport 3.18, SUM in IIF

Overworked for SQL sad

msLex wrote:

in the code

 var
==> MySum: Real;
procedure Footer1OnAfterPrint (Sender: TfrxComponent);
begin
MySum: = SUM (<BDEQuery1. "SUMA">);
end; 

4

Re: FastReport 3.18, SUM in IIF

msLex wrote:

it is passed...
If I correctly understood - all.
At first, whether it is necessary to include field value <BDEQuery1. "SUMA"> for subdividing with the code 01 in a required total sum? (Well it so to speculation)
Here it is more difficult than calculation - I told that here  - to simplify the problem description :-)
Further:
Do  the report
In a cellar of the data do invisible  with  the totals

 [SUM (<BDEQuery1. "SUMA">)] 

Field with the total

 [IIF (<BDEQuery1. "ID_DEPARTMENT"> = ' 01 ';
[MySum];
<BDEQuery1. "SUMA">] 

In the code

 var
MySum: Float;
procedure Footer1OnAfterPrint (Sender: TfrxComponent);
begin
MySum: = SUM (<BDEQuery1. "SUMA">);
end; 

All and made, invisible  considers that that is necessary, but  gives an error

 Could not convert variant of type (Array Variant) into type (OleStr) 

And this error is seen by procedure
procedure Footer1OnAfterPrint (Sender: TfrxComponent);
begin
MySum: = SUM (<BDEQuery1. "SUMA">);
end;
That  is not considered such sensation here.
Can here  substitute value from invisible ?
(Type MySum: = Memo25.text)

5

Re: FastReport 3.18, SUM in IIF

And if so?

 MySum: = SUM (<BDEQuery1. "SUMA">, MasterData1) 

6

Re: FastReport 3.18, SUM in IIF

msLex wrote:

and if so?

 MySum: = SUM (<BDEQuery1. "SUMA">, MasterData1) 

Trial and error method  on such - even if

 MySum: = 1000; 

and

[IIF (<BDEQuery1. "ID_DEPARTMENT"> = ' 01 ';
[MySum];
<BDEQuery1. "SUMA">]

That the same error, if
[IIF (<BDEQuery1. "ID_DEPARTMENT"> = ' 01 ';
123 ;
<BDEQuery1. "SUMA">]
That errors are not present!!!!