View Full Version : Staggered tabs for kitting?

April 8th, 2011, 05:57 AM
I have a job on which we want to place colored tabs along the back, bottom edge for kitting purposes. The idea would be that data will be sorted by the kit they belong to (i.e. 2, 3, 5, 6, 7, 9, 13...) with anywhere from 0 to 100 records per kit. For the first kit in the data, the first of 8 tabs needs to be filled with Black. When the kit number changes, the first tab would revert to a fill of None and the 2nd tab would be colored Black. After the 8th new kit, the colored tab would go back to the first one. As you can see in the example above, all records of one kit will be grouped together in the data, but a kit number can be skipped entirely (no variable items in that kit).

I have created the following code in an OnRecordStart rule:
if (FusionPro.Composition.inputRecordNumber == 1) {
lastbox = Field("boxid"); // the kit number from data
lastblock = 0; // the filled tab on template, cycling 0-7 positions
else {
if (Field("boxid") != lastbox) {
lastbox = Field("boxid");
lastblock = ((lastbox+1) % 8);
FindGraphicFrame("block" + lastblock).fillColorName = "Black";
When I try to preview the data, only the first record works correctly. I assume this is because in preview mode, each record is composed individually so the global variables never have a chance to initialize and step through the proper values. If I compose the entire job, the colored tabs jump around instead of stepping from 1st to 2nd, 2nd to 3rd, etc.

I am attaching a zip file with a sample template, data and incorrect output to show the problem I'm having. Can anyone determine what I need to change in my code, or suggest an alternate way of handling this senario to produce the results I am looking for?

April 8th, 2011, 10:42 AM
Whoops...There's a problem with the variables used. Check this line of code again:
lastblock = ((lastbox+1) % 8);

Should be:
lastblock = ((lastblock+1) % 8);

Naturally, I spent a bunch of time digging and testing before noticing that! :rolleyes:

April 11th, 2011, 05:46 AM
Well ain't that just a "d'oh!" moment...