You are viewing limited content. For full access, please sign in.

Question

Question

Increase Number After Form Submission

asked on August 26, 2022

We have a process in Forms that is used for requesting new addresses and changes to addresses.  When they come in, staff names the entry (AR22-001, AR22-002, AR22-003, and so on), fills in some template info, and starts a BP.  We are looking to automate that piece if possible.  Form comes in, named automatically (keep a running tally somewhere), and kick off the BP.

Has anyone done something similar to this?  Any insight would be greatly appreciated.  Thank you!

1 0

Replies

replied on August 26, 2022 Show version history

Hi Bill,

Not as simple as I would have hoped, but I had a customer ask for this exact same thing this morning, so I created a setup that seems to work. 

EDIT: After further testing, I realized my first method could create duplicate numbers (if a 2nd form was started before the 1st was submitted), so I've switched things up so all the numbering happens with Rules Service Tasks. This means the auto number isn't shown on the first form, but should prevent duplicates in 99% of cases. Instructions below have been updated.

NOTE: There is still a small chance of duplicate numbers being created if two forms are submitted at the same time (2nd submission while the 1st is between the SELECT and the INSERT). 

These instructions are for Cloud, but I believe they should be adaptable to On-Prem.

Auto Number Field in Forms

  1. Create a single column Lookup Table with a single value to start, either 0 if you wish the auto number to start at 1, or your starting number - 1 (the table holds past values)
  2. Create a Select rule for the lookup table selecting the single column, with the Function set to 'Max' and the Quantifier set to 'Distinct' (this selects the highest value in the table)
  3. Create a Formula that adds 1 to an inputted number
  4. Create a Insert rule that takes a number and inserts it in the Lookup Table
  5. Create two fields in the form: one called 'Last_Auto_Number' (which you will want to hide) and one to hold the auto number you want displayed/attached to the form
  6. Use three Rules Service Tasks placed after the form to run the Select query, the Formula, and the Insert Query (in that order). Set the Select query to write the value from the table to Last_Auto_Number, set the Formula to input the Last_Auto_Number and output to your displayed auto number field, and the Insert query to write the displayed auto number field value (the value attached to the current form/process) to the Lookup Table
0 0
replied on August 29, 2022

This still runs a chance of duplicates on concurrent or close-together forms submissions as 2 or more rules can query your table before the updated value is written back.

For self-hosted setups, you should use SQL sequences to generate numbers. SQL server will handle multiple concurrent requests without generating duplicates.

0 0
replied on August 29, 2022 Show version history

@████████

Are you on version 11?  These screenshots look way different than anything I've ever seen, lol.

 

Thanks for the feedback, I really appreciate the time you took to put together your response

0 0
replied on August 29, 2022

@████████

Probably not an issue in my particular case, but I can see that being an issue with high throughput forms, so I've added a note to original response.

Is there anyway to make this cleaner without resorting to tools outside of Laserfiche Cloud? If I created a list of numbers (say 1-10000) ahead of time then used an UPDATE to write instance IDs to the numbers (creating a map between number and instance ID), would that prevent collisions?

 

@████████

You're welcome! It's Laserfiche Cloud (all managed through a web interface) thus why it looks so different from 10 (and 11.)

1 0
You are not allowed to follow up in this post.

Sign in to reply to this post.