MarcomCentral (PTI) and FusionPro User Communities

MarcomCentral (PTI) and FusionPro User Communities (http://forums.pti.com/index.php)
-   Barcodes (http://forums.pti.com/forumdisplay.php?f=34)
-   -   datamatrix help (http://forums.pti.com/showthread.php?t=5145)

Mike Edwards June 1st, 2018 03:10 PM

datamatrix help
 
Hi, everybody! First time posting. I've got a problem in getting a properly-formatted Datamatrix barcode to print for use with our intelligent inserter. It has to be of the format X999999SSTT where XX is a string, 999999 is a zero-padded sequence number, SS is a zero-padded number representing the current sheet, and TT is a zero-padded number representing the total sheets being inserted. Here is the code I came up with:

Code:

{
// Rule converted from XML Template "DataMatrix Barcode Rule":
/* The goal here is to generate the proper Datamatrix 2D barcode
 * using the established pattern for our Rival inserter.
 * FusionPro does not have the notion of simplex/duplex, so we
 * have to state up front what that is.
*/
// Choose the following values:
var JobIDseq            = "INSCODE"; // Standard EDWARDS field name
var TotalSheets            = "SHEETS"; // Standard EDWARDS field name
var Sides            = "Simplex"; // Use Duplex here for duplex jobs. Mixed modes are not supported. :p
var EncodingMode    = "ASCII";
var PreferredFormat = "0";
var PointSize            = 6; // "Font size (defaults to 10)": SingleLine
var NoFontTag            = false;
var Font            = "IDAutomationDMatrix";
var ProcessTilde    = false;

var TotSheets            = FormatNumber( "00", FieldOrRule( TotalSheets ) );

// For simplex jobs, the current sheet is simply the page number.
// For duplex jobs, we have to do some basic math.
var CurrSheet            = Sides == "Simplex"
                    ? FormatNumber( "00", FusionPro.Composition.currentPageNumber )
                    : FormatNumber( "00", Math.ceil( FusionPro.Composition.currentPageNumber / 2 ) )
                    ;

var DataToEncode = FieldOrRule( JobIDseq ) + CurrSheet + TotSheets;
return MakeDataMatrixBarcode(
    DataToEncode,
    ProcessTilde,
    EncodingMode,
    PreferredFormat,
    PointSize,
    NoFontTag,
    Font
    );
}

Everything seems to work except for assigning CurrSheet. It appears that FusionPro.Composition.currentPageNumber is not returning the correct value. Either that or I'm using FormatNumber wrong.

Dan Korn June 4th, 2018 10:11 AM

Re: datamatrix help
 
The FusionPro.Composition.currentPageNumber property returns the page number in the record, so if each record is outputting one or two pages, it will always be page one or two, in every record. You can use FusionPro.Composition.pageNumberInJob instead. But in an imposed job, you probably want FusionPro.Composition.impositionSheetNumber. The FusionPro.Composition.impositionSheetIsBack property may be useful as well.

Mike Edwards June 4th, 2018 10:50 AM

Re: datamatrix help
 
Yes, I get that, and it's what I expect, but this code is returning "00" for CurrSheet in every instance. I was hoping someone could tell me if my syntax is wrong or what the problem might be.

Mike Edwards June 4th, 2018 02:30 PM

Re: datamatrix help
 
Further testing shows that although when I run Validate during rule construction I get the correct value, when the job previews or is composed, it still shows "00" every time. Am I not understanding how this is supposed to work, or is there a bug?

Dan Korn June 4th, 2018 06:28 PM

Re: datamatrix help
 
Quote:

Originally Posted by Mike Edwards (Post 21209)
Yes, I get that, and it's what I expect, but this code is returning "00" for CurrSheet in every instance. I was hoping someone could tell me if my syntax is wrong or what the problem might be.

Yes, "this" code, as in the only code you've posted so far, won't work.

Did you try using FusionPro.Composition.impositionSheetNumber instead, as I recommended?

Posting the template would probably be helpful than more rounds of back-and-forth like this.
Quote:

Originally Posted by Mike Edwards (Post 21211)
Further testing shows that although when I run Validate during rule construction I get the correct value

I don't see how you could possibly know that. First of all, there's no actual page or sheet number at rule validation time; it's just a rule, with no context of where you might be when actually composing.

Second, if you validate the rule you've posted, all you will get are some markup tags that make a DataMatrix barcode, which look something like this:
Code:

<f name="IDAutomationDMatrix"><z newsize="10"><leading newsize="100">AIHPDOCIHK<br>AEMONMCLLK<br>DLLDDDLDLL<br>
How do you know at validation time whether that's the correct value?
Quote:

Originally Posted by Mike Edwards (Post 21211)
when the job previews

Preview is a completely invalid test here as well, since you're not imposing the output, you're just previewing a single record, one-up.
Quote:

Originally Posted by Mike Edwards (Post 21211)
or is composed, it still shows "00" every time.

Again, how does it "show" this? Are you scanning the barcode? With what scanning device and software?

Perhaps posting a picture of the barcode would give me some idea of what you're talking about. Though as I said, the template would be better.
Quote:

Originally Posted by Mike Edwards (Post 21211)
Am I not understanding how this is supposed to work, or is there a bug?

We're not understanding each other, at least.

I'm trying to help. But I don't have your data, or the rest of your template. I don't know what you're seeing in the output, or how you're analyzing it. I can only look at the code you've posted and try to guess as to what's wrong. Please post the template so I can fully analyze the issue.

Dan Korn June 4th, 2018 06:44 PM

Re: datamatrix help
 
I think this will work:
Code:

var TotSheets = FormatNumber( "00", FusionPro.Composition.impositionTotalSheets );
var CurrSheet = FormatNumber( "00", FusionPro.Composition.impositionSheetNumber );

But you have to actually be making imposed output, not non-imposed output, and not a Preview, and validating the rule in the editor won't do you any good either.

Again, I don't have your job files, so I can't test this for you in the context of your job. But I do know that those properties work in the sample job posted here:
http://forums.pti.com/showpost.php?p=11530&postcount=3
That sample also shows how to put per-sheet post-press control barcodes and other such information on the imposed sheet, outside the area of the imposed page contents, which is probably what you want to do for your inserter anyway.

Mike Edwards June 5th, 2018 07:22 AM

Re: datamatrix help
 
My apologies. I guess I wasn't being clear. There is no imposition on this job. Each record gets 6 letter-size pages duplexed on 3 sheets of paper as output. For our inserter equipment to properly read the barcode, a portion of the barcode must read 0103, 0203, and 0303 (sheet 1 of 3, 2 of 3, and 3 of 3). This tells the inserter when it is done with one record and can fold and insert, and move on to the next set. However, this code produces 0003 for every page. We checked it with a barcode scanning app known to work. It scans just fine, but the value returned is not what we need.

As a test of what currentPageNumber returns, I made a simple rule and inserted it into the cellphone.pdf tutorial piece:
Code:

var CurrPage = FusionPro.Composition.currentPageNumber;
return CurrPage;

When I click validate on that rule, it shows "1". When I preview it and when I compose it, it shows "0". It seems to me that it isn't returning what I think it should be.

I am new to these forums and am hesitant to post customer data and/or art in this public space. However, we did send it to Alex at Marcom support on Friday, but his response was word-for-word the same as your initial post here and we haven't heard a response to my follow-up.

If we weren't under a time crunch on this project, I wouldn't be following both methods of inquiry.

Thanks for your assistance.

Dan Korn June 5th, 2018 09:07 AM

Re: datamatrix help
 
Can you specify the exact versions of FusionPro, Acrobat, and your operating systems?
Quote:

Originally Posted by Mike Edwards (Post 21214)
As a test of what currentPageNumber returns, I made a simple rule and inserted it into the cellphone.pdf tutorial piece:
Code:

var CurrPage = FusionPro.Composition.currentPageNumber;
return CurrPage;

When I click validate on that rule, it shows "1". When I preview it and when I compose it, it shows "0". It seems to me that it isn't returning what I think it should be.

You probably need to check the "Re-evaluate this rule for every text flow" box.

Mike Edwards June 5th, 2018 10:46 AM

Re: datamatrix help
 
That checkbox solved the problem.

Thanks!


All times are GMT -7. The time now is 08:28 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2022, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.