Skip to main content
GatsbyNZ
Known Participant
January 25, 2023
Answered

Generating Sequential Number

  • January 25, 2023
  • 1 reply
  • 586 views

Hi, I have created a button to spawn new pages based on the template page in a PDF form. and in the template page, there is a field to generate sequential number everytime I spawn a new page, the trouble is every time I saved it and reopen it, the number goes up by "1", which messed up the whole document, so how am I able to set a condition to it to stop it updating every time I save it and reopen it. Does anyone have a clue to it please? Thanks very much.

 

The scripts I used for both spawning page and sequential numbering are here:

this.getTemplate("Task Card").
spawn(this.pageNum+1,true,false);

 

var num = this.getField("task no 1");
num.value = Number(num.value)+1;
num.defaultValue = num.value;

This topic has been closed for replies.
Correct answer try67

Instead of doing it like that you should use the page property of each field, like this:

event.value = (event.target.page+1);

Then run the calcuateNow command after spawning the pages, and it should be fine.

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
January 26, 2023

Instead of doing it like that you should use the page property of each field, like this:

event.value = (event.target.page+1);

Then run the calcuateNow command after spawning the pages, and it should be fine.