Multi-Line Summary in Group Footer
How can a multi-line summary in a group footer be provided using the
end-user capabilities?
(Group Header)
(Detail)
XXXXXXXXXXXXXXX $100 CodeA
XXXXXXXXXXXXXXX $150 CodeA
XXXXXXXXXXXXXXX $125 CodeB
XXXXXXXXXXXXXXX $200 CodeA
XXXXXXXXXXXXXXX $110 CodeB
XXXXXXXXXXXXXXX $200 CodeC
(Group Footer) Total $885 CodeA $450
CodeB $235
CodeC $200
The values of "CodeX" are are not fixed and must be derived from the data.
TIA,
Tom
end-user capabilities?
(Group Header)
(Detail)
XXXXXXXXXXXXXXX $100 CodeA
XXXXXXXXXXXXXXX $150 CodeA
XXXXXXXXXXXXXXX $125 CodeB
XXXXXXXXXXXXXXX $200 CodeA
XXXXXXXXXXXXXXX $110 CodeB
XXXXXXXXXXXXXXX $200 CodeC
(Group Footer) Total $885 CodeA $450
CodeB $235
CodeC $200
The values of "CodeX" are are not fixed and must be derived from the data.
TIA,
Tom
This discussion has been closed.
Comments
This would be possible to do completely in the End-User environment if you
have RAP. Using RAP, you can enter the "Calculations" section of a
TppVariable and write code to make the proper calculations. Something like
the following...
(Detail)
XXXXXXXXX $100 CodeA ppVariable1
XXXXXXXXX $150 CodeA ppVariable1
XXXXXXXXX $125 CodeB ppVariable1
XXXXXXXXX $200 CodeA ppVariable1
XXXXXXXXX $110 CodeB ppVariable1
XXXXXXXXX $200 CodeC ppVariable1
(Group Footer) Total $885 CodeA ppVariable2
CodeB ppVariable3
CodeC ppVariable4
Then by right clicking on ppVariable1 and selecting the Caclulations
section, add code to check the Code value for this record and update the
valuse of Variable 2, 3, and 4 accordingly.
If you do not want to use RAP, you will need to add some similar code in the
Variable.OnCalc event in Delphi.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I have just upgraded to Enterprise and will give that a try.
Thanks,
Tom
like
Since I don't know in advance how many CodeX values will appear (and how
many ppVariables are needed in the total), what is the best way of handling
this using RAP as you suggest. I would normally use an array to accumulate
the totals but that doesn't seem possible with RAP.
Tom
You should be able to create a TStringList that simply stores the code names
as you come across new ones. For instance, in the ppVariable1.OnCalc
event...
//"CodeList" is a TStringList you create and destroy.
lsCodeName := DataPipeline['CodeName'];
liCodeIndex := CodeList.IndexOf(lsCodeName);
//Check for new code value
if liCodeIndex = -1 then
begin
//Add the new code name to the StringList
//Create a new Variable and add it to the StringList.Objects array under
the same index
//Set the new variable's initial value
end
else
begin
//Update existing variable's value
TppVariable(CodeList.Objects[liCodeIndex]).Value := etc...
end;
Remember that you are never even using the value of ppVariable1, you are
only using its OnCalc event to make other calculations. This variable could
be invisible if you want. Good luck.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
names
under
could
Thank you. I will give your idea a try.
CodeList is a TStringlist created in the GlobalOnCreate event. Variable1
(hidden) is located in the detail band. In its OnCalc event, I have the
following RAP code:
var
VendorCode : string;
liCodeIndex : integer;
TempVar : TppVariable;
begin
VendorCode := FundReq['Vendor'];
liCodeIndex := CodeList.IndexOf(VendorCode);
if liCodeIndex = -1 then
begin
{ add vendor code to list and set initial value }
TempVar := TppVariable.Create(GroupFooterBand3);
TempVar.Value := FundReq['CurrCharge'];
Codelist.AddObject(VendorCode, TempVar);
end
else
begin
{update value for existing vendor code}
TempVar := TppVariable(CodeList.Objects[liCodeIndex]);
TempVar.Value := TempVar.Value + FundReq['CurrCharge'];
TppVariable(CodeList.Objects[liCodeIndex]) := TempVar;
end;
end;
The intent of the code is to accumulate the "CurrCharge" values for each
"Vendor" and display those totals in the GroupFooterBand3. It appears as
though the values are being accumulated properly, but I am not sure how to
get from CodeList (stringlist) to variables appearing on the Footer. How do
I accomplish that? In what event? How are those variables positioned? How
do I control the height of the Footer band to allow for the variable sets?
Tom
Sorry, I forgot to tell you about that part.
Perhaps in the FooterBand.BeforePrint you can loop through the list of
objects and set each of their band property and position properties so they
will print correctly. I have never personally done this in RAP so you may
want to try this in Delphi code first to make things a little easier when
debugging, then move the code to RAP.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
they
I can't get the variables to show on the Footer. Using the ShowMessage, I
can see that the values are correct. The following code is in the RAP
BeforePrint event:
Var
liCodeIndex : integer;
begin
for liCodeIndex := 0 to CodeList.Count - 1 do
begin
showmessage(CodeList[liCodeIndex] + ' ' +
TppVariable(CodeList.Objects[liCodeIndex]).Value);
TppVariable(CodeList.Objects[liCodeIndex]).Band := GroupFooterBand3;
TppVariable(CodeList.Objects[liCodeIndex]).Left := 6.0;
TppVariable(CodeList.Objects[liCodeIndex]).Top := 0.4 + (0.2 *
liCodeIndex);
TppVariable(CodeList.Objects[liCodeIndex]).Width := 0.8;
TppVariable(CodeList.Objects[liCodeIndex]).Height := 0.18;
TppVariable(CodeList.Objects[liCodeIndex]).Visible := true;
end;
end;
they
I can't get the variables to show on the Footer. Using the ShowMessage, I
can see that the values are correct. The following code is in the RAP
BeforePrint event:
Var
liCodeIndex : integer;
begin
for liCodeIndex := 0 to CodeList.Count - 1 do
begin
showmessage(CodeList[liCodeIndex] + ' ' +
TppVariable(CodeList.Objects[liCodeIndex]).Value);
TppVariable(CodeList.Objects[liCodeIndex]).Band := GroupFooterBand3;
TppVariable(CodeList.Objects[liCodeIndex]).Left := 6.0;
TppVariable(CodeList.Objects[liCodeIndex]).Top := 0.4 + (0.2 *
liCodeIndex);
TppVariable(CodeList.Objects[liCodeIndex]).Width := 0.8;
TppVariable(CodeList.Objects[liCodeIndex]).Height := 0.18;
TppVariable(CodeList.Objects[liCodeIndex]).Visible := true;
end;
end;
Why don't the variables appear?
Tom
I'm sorry for the delay, it turns out this may be a little more difficult to
do than I initially thought. I'm currently putting together an example that
should help. Once I get it done, I'll post it for you. Thanks for your
patience.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Ok, I finally got it working. A bit of a different approach this time. It
turns out you need to add the components to the report inside or before the
Report.BeforePrint event fires. I places all the code to add dynamic
variables inside the Report.BeforePrint event because I needed to know how
many variables to create and the only way I could do that was to create a
separate info query in DADE that just returned the count of distinct vendor
numbers. If you have any questions about how the example works, feel free
to contact me. Hope this helps.
http://www.digital-metaphors.com/tips/DynamicVarInRAP.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com