Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

How to calculate an automatically increasing number on a form

Avatar

Level 1

I know this has been asked multiple times, but after googling for an answer, I still can't figure out exactly how to accomplish this task. I'm completely new to the program and know very little coding, so if you can help, please explain in baby steps.

My company is trying to use LiveCycle to create a form for Work Orders. However, every time we open up the form to fill a work order out, we need the next incremental number to show up and be registered by the response sheet. We're starting from 20,000 and going up from there. Does anyone know how to solve this issue? It's the only thing keeping us from using these forms currently!

Thanks.

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

No, LC Designer ES is just one component within the Enterprise Suite - there are many more components. The Enterprise Suite is a server based product that can be used to set up workflows. More info on the Adobe website.

With LC Designer ES you can create forms that can be used standalone or that can connect to a database.

The solution I gave would not be user entered. You would start off the form with a Works Order number of 2000 and the script would automatically add a 1 each time it was opened.

However looking at your setup I can see that this is not going to work.

The next choice is to base the Works Order numbers on a number that is generated from the current date and time.

The sample here has two examples: https://acrobat.com/#d=7MTJmmhWCVSfQQir3XwxXQ

The first sets the reference number when the Name field is not null. The second reference number is set when the form is opened. I think the first option would suit you better. The number will be sequential.

Acrobat.png

Note that you can shorten this if necessary - just showing an option.

You can also create a HASH key based on the values of several fields in the form. This would be random and not sequential. For example:

Acrobat.png

Hope that helps,

Niall

View solution in original post

3 Replies

Avatar

Level 10

Hi,

I suspect that you are not using the full LC Enterprise Suite (???). If you were, you could set up a workflow to keep track of the current order number.

If you are using a standalone form, then you could have the following script in  the docReady event of the order number object:

this.rawValue +=1; 

This will work if the Works Order number object is a numeric field.

The += tells Acrobat to take the current value of the field and add 1 to it. It is the exact same as:

this.rawValue = this.rawValue + 1; 

This will only work if you always open the last Works Order and then input the new details. If multiple people open the form, then the numbering could get out of order.

The more robust way would be to use a database to keep track of the Works Order numbers, but this will require a bit more work.

Hope that helps,

Niall

Avatar

Level 1

I am using LiveCycle Design ES (v 8.2.1), so I'm assuming that would be the Enterprise Suite. However, I haven't seen anything about the workflow keeping track of numbers. Regardless, the number would need to be automatically generated - not user inputted. We have to have the specific order number so we can recall order details when a customer just places Order #xxxxxx again.

A code like that wouldn't work so well for us, as we do have multiple people on multiple computers needing to fill the information out. Any other suggestions?

Avatar

Correct answer by
Level 10

Hi,

No, LC Designer ES is just one component within the Enterprise Suite - there are many more components. The Enterprise Suite is a server based product that can be used to set up workflows. More info on the Adobe website.

With LC Designer ES you can create forms that can be used standalone or that can connect to a database.

The solution I gave would not be user entered. You would start off the form with a Works Order number of 2000 and the script would automatically add a 1 each time it was opened.

However looking at your setup I can see that this is not going to work.

The next choice is to base the Works Order numbers on a number that is generated from the current date and time.

The sample here has two examples: https://acrobat.com/#d=7MTJmmhWCVSfQQir3XwxXQ

The first sets the reference number when the Name field is not null. The second reference number is set when the form is opened. I think the first option would suit you better. The number will be sequential.

Acrobat.png

Note that you can shorten this if necessary - just showing an option.

You can also create a HASH key based on the values of several fields in the form. This would be random and not sequential. For example:

Acrobat.png

Hope that helps,

Niall