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

Value based on Page Number 1

Status
Not open for further replies.

jonbarr

MIS
Jun 20, 2003
66
NZ
Using CR 8.0

I would like to show a value from one page on another page, i.e. on Page 1, I would like to show a value from Page 3 alongside the value for Page 1.

e.g. something like "If PageNumber = 1 then {Site#} from PageNumber 3"

Page one of the Report to look like
Location: [value for Page 1][value from Page 2][value from Page 3][value from Page 4]etc.

The report is to show all of the details (up to 50 fields) regarding an inventory item. All of the details have a unique value except for "Location" which can be at up to 10 different sites. At present the report prints a separate page for each location, whereas I want to show all of the listed locations side by side on one row of one page . I'm able to show the second location using the 'Next' function, and the last location using the 'Maximum' function, but of course if there are more than three locations, this isn't sufficient.


 
Try supplying technical information:

Database/connectivity used
Example data
Expected output

Since you're using Crystal 8.0, a Variable/formula can only hold 254 characters for output, so this gets a bit tricky if you have 50 locations (that would mean including spaces, a location couldn't exceed 5 characters, or you'd have to use multiple variables/formulas).

The simplest approach would be to insert a multi column subreport into the part number group header or footer, linked by the part number to get the desired output.

If it's going to be less than 254 characters, use the 3 formula method and display the output in the part number group footer, as in:

Group Header formula:
whileprintingrecords;
stringvar TheLocs := "";

Details section formula
Group Header formula:
whileprintingrecords;
stringvar TheLocs := thelocs+{table.location}+", "

Group Footer formula:
whileprintingrecords;
stringvar left(TheLocs,len(TheLocs)-2)

-k
 
You could also insert a crosstab into the report header. Choose the location field as the column, use no row field, and choose the location as the summary field, using maximum or minimun or Nth most frequent as the summary. Then suppress the row and column labels. In format crosstab, go to customize style->format grid lines->uncheck "Show grid lines."

Another method, which is more tedious, but which gives you more control over spacing) is to create a formula like the following to place in the report header:

if distinctcount({table.location}) = 1 then
nthmostfrequent(1,{table.location}) else

if distinctcount({table.location}) = 2 then
nthmostfrequent(1,{table.location}) + ", "+
nthmostfrequent(2,{table.location}) else

if distinctcount({table.location}) = 3 then
nthmostfrequent(1,{table.location}) + ", "+
nthmostfrequent(2,{table.location}) +", "+
nthmostfrequent(3,{table.location}) else //etc., up to 10

-LB
 
Thanks for the prompt replies.

Have not used variables, crosstabs or the nthmostfrequent function before, so obviously have lots more to learn.

The cross-tab gave me the result that I wanted, but not in the right place, so I have re-arranged the body of the report to accomodate the changed placement.

Many Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top