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

Having multi records in a heading

Status
Not open for further replies.

bigfoot

Programmer
May 4, 1999
1,779
US
I have a report that I'm rewriting for someone that has a header full of hard coded items.

The report looks like this.

Report for item numbers:
"123,423,543,567,234.." and on and on.

Under that is the normal report for the item numbers mentioned in the heading.

These are all hard coded in the header text and in a monster OR, where clause.

Every time I need to add a new item to the report I have to change the hard coded header plus in the where.

I came up with a table with all the items in it that will link to the main items table for processing. This way all my user has to do is add a new item number to the table and it will appear on the report.
And I'm out of the loop.

Normally I would use a cursor to append all of the item numbers in this table together.

Any better way to do this in Cryatal? I'm working with 8.5 and XI soon.

Thanks.
 
Open the report, look at where the item is, to the left it states the name of the section. You know this though, you've posted here many times and you also know that we need to have this information.

If you think that we already knew this, or that the solution has nothing to do with the layout of the report, you're mistaken.

I've assisted you in the past, and the same types of questions are always asked.

If anyone has an attitude it's you. I ask you to clarify, and you think it unreasonable that you should have to take the time to supply such information. If I'm direct it's because I think it rude to approach other people's time, especially those trying to help you in such a cavalier way.

These aren't blogs, they're technical forums. Try to be concise and take the time to state specifics no matter how frustrated you are.

-k
 
Sorry again, about that.
It's been a long day and it's only 11am.

As best as I can describe:

The current report is a normal select items report.
Nothing special. I want to replace it. Toss it in the garbage and start over. it's a mess because of the hardcoded values.



New report of my design:

In the Report Heading Section:
A title and date (usual heading information).

A TextBox containing a comma delimited listing of all of the items in the table I created.
The table information follows.

The table will be created in SQL Server 2000, and have only 1 field, which will be the item number (item_number).
The layout will be something like this:

Tablename: QC_Items
Column: item_number varchar(30)
Primary Key: item_number unique

The item_master table is nothing special.
A table named item_master with few fields, keyed off of the field [item_number varchar(30)].


Report Detail Section:
The body of the report will be a simple select from the item_master table inner joined with the items table that I will be creating:

SELECT dbo.item_master.item_number
FROM dbo.QC_Items INNER JOIN
dbo.item_master ON dbo.QC_Items.item_number = dbo.item_master.item_number



This part works fine. I can get the report running.


=======
In lieu of a cursor you might use a subreport and concatenate the values in a string, hard to know as you give no indication of the report layout nor the fields involved.
=======
This is the part that I don't know how to complete. I have done a sub report before, but how do you get all of the items that the select brings back, to concat together with commas into a text box?


Again, sorry for any attitude.
I was discussing an idea rather then an existing situation.
And frustrated by the lack of help in the help file on the formula editor.

When I posted, I was at the point of screaming. I can't wait to get XI, and I am hoping to have a stopping point to go through Crystal from the beginning, and learning the full package.

Thank you very much for any and all help.
If you need any more information, please ask, but I'm hoping this will be ok.

~G





 
A bit of a trick here regardless of how you approach this.

You can build a subreport that uses your table in a report header section PRIOR to the report header section where you are displaying (right click and select insert section below) and display them in a concatenated form, or you might just insert a crosstab and select the field as the column and you might be willing to live with that.

To use the subreport method, in the details of the subreport place:

whileprintingrecords;
shared stringvar Output;
Output:=Output+{table.field}+","

Then shrink the upper report header section of the main report (the one with the subreport in it) as small as you can (don't suppress it).

Then in the second report header section, where you want to display the list, place the following formula:

whileprintingrecords;
shared stringvar Output;
left(Output,len(Output)-1)

So the first report header will read in your values to a shared variable, and then the main report will reference that shared variable to provide the output.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top