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

CR11 - Grouping based on array or a global var?

Status
Not open for further replies.

chrisv91301

Programmer
Aug 23, 2006
6
US
Hi gentlemen,

Been doing this for a while and now am kind of stuck on this one issue. trying to make a report which would print out the # of pages based on an array or parameter.

To describe it better:
Database Fields:
NUMBER_OF_INTERNAL_COPIES
FLAG1
FLAG2
FLAG3

So if all flags are Y and NUMBER_*** = 3 then it should print 6 pages. 3 of internal copy pages (this is the problem) and one for each flag (this was easy)

if any of the flags is selected that "flag" gets a page printed for them.
But where its difficult is:
number of internal copies should also print out a specific # of pages. However I just cant get that to work. really seems like thats not a designed functionality.
i tried putting that number into a global var, array, etc... but these i cant group on to create a group or make it go over one page.

Is there any way to make this happen without making 2 different reports simply?
 
Crystal can print a single copy of whatever data is there, or a subset of the data.

I guess that the number of internal copies means that you want that many copies of each page?

Crystal won't do that without either duplicating the data, or since you are printing a single page for each flag, you might right click the details and select insert section below and place the fields in each section and conditionally suppress the detail sections based on the numebr of copies requested.

Another means is to create a table of:

Copies
1
2
2
3
3
3
4
4
4
4
...etc...

And join the Copies filed to your data, and you'll get that many rows.

I think that you should take the time to think about requirements, and try to rephrase your question though.

-k
 
i guess the question is:

can i make a group based on array contents?
stringvar array xyz;
xyz = ["A", "B", "C", "D"]
and having a group that would group on these values?
 
Grouping is performed in Crystal as it is in any database language or SQL, it's based on the data.

An array isn't data.

You might use a formula on a field such as:

left({table.field,1)

To further clarify, how would Crystal or SQL know what data falls into your A, B, C... groupings?

-k
 
Another option would be to hardcode values (bad idea), such as:

if {table.field} in [100,200, 300] then
"A"
else
if {table.field} in [400,500,600] then
"B"
else
...

Bad idea though, this means that you'd have to go into the report when any ne values show up in the database.

Th essence of what you intend to do is what relationsal databases are intended to resolve by themselves.

-k
 
i thought about hardcoding.... problem is value runs from 1 to 99 which means that a lot of sections to suppress. we'll probably just end up controlling the printing from the printer dialog box instead versus inside a report, looks like the easiest solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top