Expand my Community achievements bar.

How do I get a numeric box to display sequential numbers?

Avatar

Level 2

My boss has a word document on which he wants to have a numerical counter.

I cannot figure out how to do such a thing in Word. So, I am now working with the document in LiveCycle Designer.

I placed a numeric field where I want the counter to display. I would like the counter to start with, say, 2001 and work its way upwards- so that if I print 150 of them, they are numbered 2001, 2002, 2003, etc all the way up to 2150. My question is, what exactly do I put into form calc to get the numeric box to count up that way depending on the number of copies I print? Any help would be very much appreciated.

16 Replies

Avatar

Level 2

I saw this

http://forums.adobe.com/message/2938435

and I thought this might work just as well... but someone would have to explain to me exactly what to do with it.

I need to be told what to select for show, which language, etc.

Thank you so much for reading this, I appreciate it.

Avatar

Level 4

you would want to initialize the form, then on the postPrint event, do a fieldName.rawvalue += 1;  so each time the print dialog is brought up, you will be incrementing the counter after the form is printed.

Avatar

Level 2

So... what you are saying is that I:

choose postPrint

fieldName.rawvalue += 1 (my field name is "Counter" so I type Counter.rawvalue += 1

choose FormCalc

choose client

and save

(Correct? Sorry to spell it out like this, but I have to explain all of this to my boss.)

What will happen after I do this is that I will open the pdf normally and, each time the print dialog is brought up, the counter will go up by one.

This sounds good- but how do I go in and change the number at which the counter starts? If I want to start at 2001 instead of 1, what should I do?

Avatar

Level 2

I have to be off with something here because it isnt working. Are the += reversed like it says on the other thread I linked to? And am I screwing some

thign up with the name of the numeric field?

Avatar

Level 4

I tend to like using Javascript over FormCalc, but I would think the syntax would be the same:

var currentVal = Current.rawValue;

Current.rawValue = currentVal + 1;

Avatar

Level 2

I got a response as an email, but for some reason I am unable to reply via email, it bounced back to me.

But here is my response:

I have made a few things using FormCalc, but I am relatively clueless on that. (I just work with people who are even more clueless on such things, relatively speaking.) I need it literally spelled out for me.

So- when I am on that numeric field I:

Choose: postPrint

Enter: fieldName.rawvalue += 1 (my field name is "Counter" so I type Counter.rawvalue += 1

Choose: FormCalc

Choose: client

and then save it.

But I tried that and it is not working, I get an error. Should I keep it as-is and choose Javascript instead? Did I make an error with including the name of the numeric field (it is called “Counter”)? Should I reverse the += signs? Also, it seems that if it DOES work it is going to start at 1. If I want to start at 2001 instead of 1, what should I do? How do I change the initial number so that it starts with what I want and counts up each time it is printed?

I really appreciate the help.

~Chris

Avatar

Level 4

Can you e-mail me the form at alex.kloft@gmail.com ?  This will allow me to see things completely and develop a solution and walk you through it better.

Thanks,

Alex

P.S. You cannot reply to the e-mails Adobe sends you because they are just letting you know someone has responded to the thread you created. Welcome to the Adobe Forums!

Avatar

Level 1

  Looks like Chris TMC and I are tackling the same/similar issue.

  I'm using LS Designer 8.2 for the first time and tasked with printing the same sheet many times (thousands of copies eventually, but only 500 at a time.) A unique number is required on each sheet as it's printed, starting with "No: 003001" and incrementing by 1 to "No: 003500". I've created a Numeric Field named "Serial" under Page1 in the hierarchy and have formatted the "No: 00" at the beginning of the string using the Pattern dialog box.  Now I just need to increment the numbers 3001, 3002, 3003, etc.  I gather from this and other posts that a for loop using FormCalc or JavaScript will solve this. Is this the correct approach? If so, how would those lines of code look?

  Any help would be much appreciated!

Avatar

Former Community Member

Certainly a loop will increment a number but we have to determine the correct event for the code. Are you sending the print as a single stream and printing 500 copies ...or are you hitting print 500 times (over time) and getting 500 unique requests.

Paul

Avatar

Level 1

Thanks for your reply.

In this case I would be printing a batch probably every couple of months when we get low, so this would be a single stream.

Avatar

Former Community Member

I don't think you will be able to do that .....I was thinking that the prePrint event coudl be used to update the number but the prePrint is firing only once for a multi-print job. I do not know of an event that woudl fire for each of the pages that you print that woudl allow us to increment the number.

Paul

Avatar

Level 1

Hmmm.  Is there any other approach using LS Designer or Acrobat 9 Pro that could work short of manually changing the number and hitting print 500 times in a row?

Avatar

Former Community Member

If you are going to hit print 500 times I can do it .....the issue with sending a single image and say print 500 times is trhat I have no means of running anycode while it is printing.

Paul

Avatar

Level 1

I realize this is from long time ago - I just ran across it when looking form something related, so if you are still looking for a solution, try this:

a script which adds records (instances) and sets a value into a field in the new record

add a print button to your form and on the click event put the following script :

// change names to reflect your hierarchy
// present user with a popup to enter their values into
var vCounter = xfa.host.response("What number do you wish to begin at?","number","");
var vPrintNum = xfa.host.response("How many copies do you wish to print?","how many","1");
// loop for looping through the records
for (var i=0; i<vPrintNum; i++)
{
// obtain a value as a start point (the page index)
var vCount = _Pg1.count-1;
// set the value of the serial number field on this page to the number in vCounter
xfa.resolveNode("Pg1["+vCount+"]").sfFormTitle.serial.rawValue = parseInt(vCounter);
// add another page
_Pg1.addInstance(1);
// increment the value in vCounter by 1 (parseInt is required to change the value to a number)
vCounter = parseInt(vCounter) +1;
}
//c all up the print dialog - the dialog values are left for you to set manually
xfa.host.print(1, "0", (xfa.host.numPages -1).toString(), 0, 0, 0, 0, 0);

// note you will have one additional record with no value in the serial number field
// the blank form is the start point for the next print job

Avatar

Level 1

Do you have directions on how to implement this? I am just learning java and not sure how to implement this code.