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!

Unusual data problem with "special" form in CR 8.5.

Status
Not open for further replies.

mpdinosaur

Programmer
Aug 13, 2003
21
0
0
US
Hi, folks;

I've got what I think is an unusual problem with printing a "special" form in CR 8.5. I'm trying to print a route card for vending machine techs that list the products in the machine on the card by underlaying a bmp under my data. Works like a charm except for the fact that I have a one-to-many relationship between the products and the machine data. There may be 1 product, there may be 50 or more. The problem is, my card needs to show the machine data only once per card, but it also needs to show up to 5 products per card. If there are more than 5, it needs to repeat the machine data and continue with the products on the next card.

My data looks something like this:

MachA Prod1
MachA Prod2
MachA Prod3
MachA Prod4
MachA Prod5
MachA Prod6
MachB Prod1
MachC Prod1
MachC Prod2

etc.

The card needs to look like this:

--------------------------------
Machine A Info Prod1
Prod2
Prod3
Prod4
Prod5
---------------------------------
Machine A Info Prod6




---------------------------------
Machine B Info Prod1




---------------------------------
Machine C Info Prod1
Prod2



----------------------------------

(Sorry it's so long.)
I've exhausted my limited supply of brain cells. Any help would be appreciated. [bigears]

Thanks.



 
Not sure if I fully understand, but you should be able to join the Machine table to the product table, then group by machine and place it in the group header, with the data in the details.

If your example data is wrong, and you have the same products repeated for a given machince, then try Database->Select Distinct Records, or also group by the product and display your data in the product group footer.

-k
 
I'm assuming that each new card is a new page. I think you can handle this by grouping on {table.machine}, checking "Repeat group header on each page," and formatting the group header field to "Underlay following sections" (format->section->group header->underlay following sections). This will bring the first detail line (product) onto the same line as the group name (machine).

Then go to format->section->details->new page after->x+2 and enter:

remainder(recordnumber,5) = 0 or
(not onlastrecord and
{table.machine} <> next({table.machine}))

This will give you a pagebreak after every fifth record or whenever the machine group changes.

-LB
 
Thanks for both of your suggestions. Things are VERY close. My remaining problem is, there are three of my forms to a page. The group is only printing one time per page.

I know this is probably very simple, but the solution continues to elude me.

Thanks again for your help.

- Mike
 
I guess you want to drag the group name to the top of each form...still not visualizing what you want...

-k
 
I guess I was trying to avoid drawing the whole thing out. Here it is. I've drawn a bitmap that I'm going to use as an underlay. I'm going to write data on top of it. The paper I'm using is perfed into thirds. The bitmap fits three times on a cut-sheet page.

If my data is this:

MachA Prod1
MachA Prod2
MachA Prod3
MachA Prod4
MachA Prod5
MachA Prod6
MachB Prod1
MachB Prod2
MachC Prod1

I want the cards to look like this:

---------------------------------------------------
MachA Prod1
Prod2
Prod3
Prod4
Prod5
---------------------------------------------------
MachA Prod6




---------------------------------------------------
MachB Prod1




---------------------------------------------------

Those three &quot;cards&quot; should equal one 8.5 x 11&quot; page. My problem is the bitmap only prints at the top of the page. I can't seem to get it to print when I need it to.

What am I missing?

Thanks again.

Mike
 
Try adding the bitmap to the pageheader three times, one below the other. Then format the pageheader to &quot;underlay following sections.&quot;

To get the Machine Info every five records, you could just put it in the detail section and then conditionally suppress the field with:

remainder(#cntwingrp,5) <> 1

//where {#cntwingrp} is a running total of {table.machine}, count, evaluate for each record, reset on change of group (Machine)

To get the right alignment for the three cards, you would have to adjust the detail section height to that five details appear per card (I guess this is obvious).

You can create a page break after three cards by using &quot;new page after&quot; as mentioned earlier, but using a different formula:

remainder({#cntwingrp}, 15) = 0 or
({#cntwingrp} > 10 and
not onlastrecord and
{table.machine} <> next({table.machine})) or
count({table.machine}, {table.machine}) < 5

This assumes you have a group on {table.machine}.I think you have to have the page break after groups with fewer than five records in order to maintain the spacing per card, although there may be another solution for that.


-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top