Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report Form? 1

Status
Not open for further replies.

JRP11

Programmer
Aug 15, 2000
8
LB
Hi,
I have a table with 4 fields, and thousands of records. using VFP 9 SP2
field name
--------
1:code
2:amount1
3:amount2
4:amount3
the table indexed on code
in the report designer, in the group header 1:code
I have this expression ..IIF(_PAGENO = 1,amount3 + amount2 - amount1, ' ')
the report is working very fine no problem.

My question is: I want to display the same value of the above expression, in the group Footer 1:code
although the cursor now on record 100 with same code different values of amounts.
Is this possible? Or is there a way to do it differently in the report?.

best regards
 
JRP11,
Yes, this is no problem. One thing you can do is just before you issure the command:
REPORT FORM <formname> TO <destination>
Issue this:

SELECT <TABLE>
SET ORDER TO <CODE>
GO TOP
lnCodeFooter = amount3+amount2-amount1

Then in your report forms footer, in the field expression just put in:

lnCodeFooter

Note that any value I've put in <...> means you just put in the name of the table or index you have, since I don't know the name of those values.



Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Also, remember to make sure that in the report properties dialog box, you have "Private data session" turned off (unchecked) in the Data Environment tab at the bottom.


Best Regards,
Scott
MSc ISM, MIET, MASHRAE, CDCP, CDCS, CDCE, CTDC, CTIA, ATS

"Everything should be made as simple as possible, and no simpler."[hammer]
 
You could do as Scott suggests, I don't know if you literally meant the value of the expression of the top record, though.

In a group footer I'd expect the sum or some other aggregation, for that you use report variables, take a look into them, you can reset them to 0 in each group and sum or do other aggregations. That's more likely what you need. I also wonder strongly about limiting the expression specifically to page 1 of the report. If you really want this to only print on page 1 then what if the first group is longer, what for the first group spanning to page 2 and why suppress this for all further groups on page2 onwards.

Even if I assume this report to start groups on a new page, the real intent is to only print this for the first group and rely on it only spanning one page always, might be sensible, but there are more direct ways to do this. For printing or not there is the printwhen expression of report controls and to only print the first group you'd initialize a variable to the group value and not reset that variable with every new group, so it stays that value throughout the whole report. Then printwhen: groupvalue == reportvariableinitedonceonlytothefirstgroupvalue

That way you print something for the first group only no matter how many pages it spans.

Also set "remove line if empty, if the control is standalone in a line, this will then condense further detail bands and not leave a gap line.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Thank you Scott,
Thank you Olaf

As scott mentioned:
******
SELECT <TABLE>
SET ORDER TO <CODE>
GO TOP
lnCodeFooter = amount3+amount2-amount1

Then in your report forms footer, in the field expression just put in:

lnCodeFooter
******
This will work if I selected records for one codes to display, not more. I have such a report for one selected code and set as you mentioned.
but I have records with 100 different codes that are displayed in the same report one after the other with group header and group footer
and every code have many records "the code is the grouping key"
so,when the cursor is on the first record of the first code it does the expression "calculation of fields value"
then continue to display the rest of records of the same code. At the last record of the same code, fields have different values
but, I want to use the value of the expression that I calculated from the first record before it continue with a new code on a new page.


Best Regards,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top