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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Displaying data from the details prior to the details section

Formula Help

Displaying data from the details prior to the details section

by  synapsevampire  Posted    (Edited  )
In particular this addresses dispaying multiple database values in the report header, however this is extremely useful for many requirements.

One scenario is that one needs to display all of the distinct values of some field that the report encompasses, and a standard minimum and maximum won't cut it.

So we use the whilereadingrecords pass to acquire the values, and the whileprintingrecords to display them.

Note that I used the Access Extreme sample database for this, and intentionally converted a numeric to string to cover more scenarios:

Detail level:
whilereadingrecords;
stringvar array id;
numbervar x;
if not(totext({Orders_Detail.Product ID},0,"") in id) then
redim preserve id[ubound(id)+1]
else
id; // Crystal required an else statement here
if not(totext({Orders_Detail.Product ID},0,"") in id) then
id[ubound(id)]:= totext({Orders_Detail.Product ID},0,"");

Now we use the whileprintingrecords in the Report Header formula to show all values:
whileprintingrecords;
stringvar array id;
join(id,",")

You can tweak this to show only specific rows as well, but this might help you get around some issues along these lines.

Note you can also do manual aggregates in this fashion to have them available before the printing pass.

-k
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top