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

Printing range of data in header and including in record selection

Status
Not open for further replies.

GCL2007

IS-IT--Management
Dec 11, 2007
167
US
Using Crystal 11.5, looking for best way to handle this. Have a series of reports that need to be executed without parameters. Need to hard code employee numbers in the record selection formula. I also want to display the employee numbers in the header as well as using them in the record selection. Am looking for the best way to handle this as I have a number of reports and employees will likely be added, deleted frequently... Looking for the easiest way to maintain within the report and not have to maintain in multiple places within the report.

 
is your field, employee number, a string value or number value in your database

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
One relatively simple approach would be to maintain the list of employee IDs in an Excel spreadsheet or Access database.

This could be joined to the other tables in your report via an Inner Join so that only the IDs on that list get included in the report.

You could then place a simple Sub Report in the Report Header to return a list of the IDs included.

Hope this helps

Cheers
Pete.
 
You could add a crosstab report to the report header, using the ID field as either the row or the column (depending upon whether you want a vertical or horizontal display) and using max of ID as the summary. Then suppress the row or column label and remove the grid.

-LB

 
Based on this statement and assuming your "Need to hard code employee numbers in the record selection formula.", try this solution.

Create a formula called emplyNo and place in your report header
Code:
If your employee number database field is a number use this code

BeforeReadingRecords;
stringvar output;
numbervar array empno := [306,400]; /// this is where you hard code your info seperated by a comma
numbervar x;
for x := 1 to ubound(empno) do
(
output := output & "," & totext(empno[x],"#")
);
output := mid(output,2)

If your employee number database field is a string use this code

BeforeReadingRecords;
stringvar array empno := ["RWS","CMC","AEE"]; // this is where you hard code yoour info seperated by a comma
stringvar output := join(empno,",");
output

in your record selection formula
Code:
If your employee number database field is a number use this code

numbervar array empno;
{Yourdbfieldforemployeenumber} in empno

If your employee number database field is a string use this code

stringvar array empno;
{Yourdbfieldforemployeenumber} in empno

_____________________________________
Crystal Reports 2011 and XI
Intersystems Cache 2012 ODBC connection

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top