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

Splitting a Range into Separate Records

Status
Not open for further replies.
Dec 13, 2004
63
0
0
US
I am using CR X with an Oracle DB. I have a range of numbers that I have to split into separate records in Crystal Reports. For example:

Range
00001 - 08900 Teacher Titles

I need the records to look like the following:
00001 Teacher Titles
00002 Teacher Titles
00003 Teacher Titles
00004 Teacher Titles


PLEASE HELP!
 
Create a formula for the report header (or group header based on range) section:

whileprintingrecords;
stringvar rangex := "00001 - 08400"; //substitute your range field
numbervar start := val(split(rangex," - ")[1])-1;
numbervar end := val(split(rangex," - ")[2]);

Then add the following formula to the detail section of the report:

whileprintingrecords;
numbervar start;
numbervar end;
if start <= end then
start := start + 1;
start

You should be able to simply add the description field to the detail section.

-LB
 
Thanks LB! However, the suggestion did not work. Maybe I did not explain the situation clearly.

I have 1 record, an example of the record is below.

Range Description
00001 - 08900 Teacher Titles

I would like the records to be split into 8900 separate records. For example:

Range# Description
00001 Teacher Titles
00002 Teacher Titles
00003 Teacher Titles
00004 Teacher Titles

Please help!
 
I understand what you mean and tested this, and it does work, so you need to explain what results you got that did not meet your requirements.

-LB
 
I added the first formula in the report header and the second formula to the detail section. The result is 1.00. Do you know why I am getting this result?
 
Please show the exact formulas you used. Also provide the value of the range you used (place it directly in the report header if you are unsure).

-LB
 
I created 2 formulas:

//REPORT HEADER FORMULA (placed formula in report header)
whileprintingrecords;
stringvar rangex := "00001 - 08400"; //substitute your range field
numbervar start := val(split(rangex," - ")[1])-1;
numbervar end := val(split(rangex," - ")[2]);

//DETAIL FORMULA (placed formula in detail)
whileprintingrecords;
numbervar start;
numbervar end;
if start <= end then
start := start + 1;
start

RESULT
1 Teacher Titles

I am seeing 1 record, not 8400 records. Please help!


 
You do have to have a table added to the report that has at least 8400 records. You can add any recurring field from the table to some report section, e.g., the report header, and then suppress it.

-LB
 
Unfortunately, I do not have a table with at leat 8400 record. I only have one record in the table. I would like to duplicate that same record 8400 times. Is there a way to do that?
 
You can add ANY table with 8400 records. If you don't have one, you could create an Excel spreadsheet, add 1 in the top cell and then use the fill function to get you to the 8400.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top