Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Need help with Custom Calculation Script, I think?

New Here ,
Dec 31, 2024 Dec 31, 2024

I have created a form with an invoice template. 

I would like the invoice number to auto populate in sequence. I have created that field, named it Invoice Number and believe I need to use the Calculate tab and enter something inside the Custom Calculation Script - am I on the right page? And if so, nothing I insert inside this box stays. I type it in, hit ok and it immediate disappears. Maybe my code is wrong? I have no idea of the correct format but have researched and copied and pasted various data I've found thinking it was correct, and still don't have the desired results. 

Please help! 





"Don’t get so busy making a living that you forget to make a life." - Dolly
TOPICS
General troubleshooting , JavaScript , PDF forms
669
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

What did you try already?
What triggers number to change?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2024 Dec 31, 2024

I do not know the answers to your questions. 

The things I tried already, I didn't save to know what they were. 

The invoice number needs to update each time a new invoice is created by the business owner. 
Am I in the right place to make this happen in this form?

If so, can you tell me the correct javasript or code to get this action to take place? Thank you so much!





"Don’t get so busy making a living that you forget to make a life." - Dolly
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

You need to know what the trigger to advance number is, for example is it when you open a file, or save file...etc?

What is the format of the number? 1, 001 or something else?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2024 Dec 31, 2024

I guess it makes sense to have the number advance when the file is opened. 

Format of the number should be 1,001.





"Don’t get so busy making a living that you forget to make a life." - Dolly
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

Ok, set the format of the field to number with 0 decimals, and enter value of 1000 to be default value.

Select 'Prepare form' tool, press SHIFT+D or select Document JavaScript from tools.

Enter name for the script (any name) click 'add' and delete anything in the window, and paste this:
this.getField("Text1").value += 1;

Change "Text1" to the name of your field.

Save file and every time document opens it will increase that field value by 1, of course document needs to be saved later.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2024 Dec 31, 2024

Ok, I've went into the properties of the field, and set the format to Number with 0 decimals.

I do not see a place to enter the default value.

 





"Don’t get so busy making a living that you forget to make a life." - Dolly
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

It's in the options tab.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024

As @PDF Automation Station mentioned, the default value is in the 'Options' tab, or you can just close 'Prepare form' tool and enter the value manually.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 31, 2024 Dec 31, 2024

Ok, thank you both for that... I got that part done... now I'm wanting to have a total column that will multiply 2 other columns to show what it equals in the total column - can you tell me how I can that?
I really do appreciate your time to help me today!

 





"Don’t get so busy making a living that you forget to make a life." - Dolly
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 31, 2024 Dec 31, 2024
LATEST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines