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!

Repeating details X times based on a max (=x)

Status
Not open for further replies.

nilsbinnemans

Programmer
May 14, 2012
14
GB
Hi,

I have data which I would like to see repeated for several periods. I only have the maximum number of periods (as a data field). How should ik copy the data the number of times I have.

for instance with the next data:

Value1
Value2
Value3
Max n° Periods= 2

I should become:

period 1
Value1
Value2
Value3

Period 2
Value1
Value2
Value3

The number of periods is variable.

Any help?

kr,
Nils
 
What's the relationship between 'Value' and 'Period'? What is the data structure?

Have you looked at Crosstab? (Well worth getting to know if you're not familiar with the option.)

If Period is something you accumulate, you may have to do it the hard way, a Mock Crosstab. Use SEARCH for details about what this means.

[yinyang] Madawc Williams (East Anglia, UK). Using Crystal 2008 with SQL and Windows XP [yinyang]
 
It seems now that I did not explain well.
What I want to copy are not only values but is almost an entire report. Using headers, several groups and details. So I figure I will not be able to do so in a crosstab.
I can't use subreports either if that would be a solution. because I might add a query for a change that only needs to be made in Period 2 (for instance).

The periods aren't data but is a parameter were the max numbers of periods is filled in. As I cannot get this data out of the database.

Ideally I think would be if I could make a data field which contains all periods between 1 and Max.
Wereafter I can make a group of it.
So it would look like this:

Group: period 1
-Group 2
-Group 3
-Details (etc.)

Group: period 2
-Group 2
-Group 3
-Details (etc.)

Group: period Max
-Group 2
-Group 3
-Details (etc.)

Is this possible?
 
If you have a table that uses sequential numbers from 1 to n, then you could add that table to the report without linking it to the original table. Then use a record selection formula like this:

{seqnotable.number} <= {?Period}

Insert a group on {seqnotable.number} and then add the original table fields to the detail section. Each group will contain the same records.

If you don't have a table with numbers like that, you could do the same thing with an excel spreadsheet where you create one column with numbers and then add the sheet to the report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top