How-To: Create a Unique Invoice Number

 

About

Many organizations use ProntoForms to generate documents like Invoices, Work Orders, and Site Inspections, which may require a unique identifier such as an invoice number.  Though the ProntoForms-generated Data Record Reference Number is guaranteed unique and may work as an invoice number for many, some organizations may wish to create their own invoice numbers.  Rather than asking users to manually enter an invoice number, or having an admin manually dispatch one, there are a number of ways to dynamically generate a unique number to help your team identify your data records.

To guarantee unique numbers/identifiers, we recommend using either the data record reference number, data record ID, or date/time as part of the expression that you configure.  

Data Record Reference Number vs. Data Record Identifier

The Data Record Reference Number is the ProntoForms system's unique identifier for a submitted data record.  It is shown beside each data record listed in the "Data Records" page in the web portal.  The reference number is always unique is composed of a string identifying the date the data record was submitted, and the Data Record Identifier, in the format "yyyyMMD-##########".  

The Data Record Identifier is simply the second part of the Reference Number.

Using Data Record Expression Language, the Reference Number is referenced with %r, while the identifier is referenced with %r[id].

 

Case #1: Name Data Record Documents with an Invoice Number

About

The Data Record Document Filename Expression is part of the configuration of many data destinations; it controls the name of the file (containing the data record document) that is sent to the destination.  Use Data Record Expression Language to name your documents with a unique invoice number.

Note that this only affects the name of the Data Record Document file -- it will not be visible in the actual data record.  What you may want to do is create an invoice number through one of the below methods so that it is present in the actual form, and also reference it in the Filename Expression.

*Remember, this is configured for each data destination, and will only apply to data records processed by the data destination.

Configure the Data Destination

The Data Record Document Filename Expression is normally found in the Data Record Document tab when configuring a Data Destination.  As you type your expression, a sample of what your filenames will look like will show underneath.  

Sample Expressions:

  • "%a[Customer ID]-%r[id]"  will create a filename like "1234567-1810010000"
  • "INV-%r" will create a filename like "INV-20140622-1810010000"

[ top ] 

 

Case #2: Create a Unique Invoice Number in the Mobile App

About

Some organizations may wish to create a unique number (like an invoice number) that displays on the device even before a form is submitted (when the data record reference number does not yet exist); perhaps the invoice number is required to be on the form before the customer signs off on it, or the invoice number must be shown in full on the actual document, not just in the document filename.

This can be done using the digit extraction control type, or a combination of digit extraction and string concatenation.  The best way to guarantee a unique number is to include a reference to a date/time selector or stamp and use digit extraction to strip non-numeric characters.

[ top ]  

Scenario and Desired String

It is easier for you to manage your customers' payments if their invoice number contains their customer number.  The desired string in this scenario is: "(Customer Number)-(date, non-numeric characters extracted)".

[ top ] 

Configuring the Form

Below is a view of the form builder, showing the questions we will use to create the invoice number:

  • A dropdown question (where the user will select a customer from a list populated by a data source)
  • A Date/Time Stamp (the input for the digit extraction control)
  • A digit extraction control
  • A String Concatenation control to string it all together and create the invoice number

customerid.png

[ top ] 

Customer ID

The question collecting the Customer Number is a dropdown question referencing a data source (of any type, here named "Customer List") that contains a list of customer name in the "Company Name" column and a list of Customer ID's in the "Customer Number" column.  below is the list in spreadsheet format.

spreadsheet.png

Your mobile users don't know the customer numbers, so it easiest for them to select the customer name, while having the form actually collect the customer number.  In the Data Source configuration section of the dropdown properties, select "Company Name" for the Display Column and "Customer Number" for the Data column.

customerlist.png

[ top ] 

Date/Time and Digit Extraction

No special configuration is required for the Date/Time Stamp itself; just ensure it is before the digit extraction control.  The digit extraction control has been configured to extract the date in the following format:  yyMMddHHmm

dateextract.png

[ top ] 

String Concatenation

In String Concatenation Properties, we can link the above fields together and add some static elements for the sake of formatting.

strignconcat.png

[ top ] 

On a Mobile Device

 generate_invoice_number_NEW.png
  • Note that although the Company Name is shown as the value for the Customer ID question, since "Customer Number" was in the data column, the number is what is used in the invoice number.

 

  • It may be desirable for some of these questions to be set to "hidden on device" to avoid cluttering your user's screens with unnecessary info.  Note that the "Customer ID" question must be visible somewhere in the form.

 

  • It may also be desirable  to mark all but the "Invoice Number" question as "hidden in reports."

 

  • Of course, there does not need to be a page dedicated to this function; the digit extraction and string concatenation questions can collect input values from various locations in your form (as long as the input values occur first), making use of the form information you are already collecting.

[ top ]

 

 

Case #3: Create an Invoice Number with the Dispatch Data Destination

About

If your workflow already includes using the dispatch data destination to dispatch data from one user to another, you have a lot of flexibility in building invoice numbers that can appear in the mobile app.  It is possible to include the data record reference number or identifier (of the form used to dispatch)  in an invoice number shown on the mobile device (in the target form).   In fact, data record expression language can be used to grab many other identifiers from the meta data of the submitted form, like user ID (%u[id]) or form id (%f[id]) that may be useful in building an invoice number.

Note: The Dispatch data Destination is the only dispatching method that allows the use of data record expression language.

[ top ]

 

String #1: "Form Identifier - Data Record Identifier"

It is possible to build the whole invoice string in your Dispatch Data Destination's "Dispatch Data" section, based entirely on the meta data from the submitted form that created the dispatch, and dispatch the entire invoice number.  In this example we will reference the identifier of the Form itself, as well as the data record ID.

*If using this method, you can also include this invoice number in the name of the dispatched form; read about Data Record Naming

Configure the Data Destination

  • Provide the label of the question in the Target Form where the invoice number should appear.  This is case sensitive.
  • For the Data Expression, enter "%f[id]-%r[id]".  This is all in lowercase.

dispatchinvoice.png

 

In the Target Form

Generate Invoice Number in Target Form.png

[ top ]

 

String #2: "INV(Customer Number)-Data Record ID"

In the "Dispatch Data" section, it is also possible to combine submitted form data with the data record ID  to create an invoice number.  See Case #2 (above) for details on how to populate the customer number in the initial/dispatching form.  Use %a[Question Label] in the data expression to reference the submitted data from the initial form used to create the dispatch. We'll also add some static text to this string.

Configure the Data Destination

  • Provide the label of the question in the Target Form where the invoice number should appear.  This is case sensitive.
  • For the Data Expression, enter "INV%a[Customer ID]-%r[id]".  This is all in lowercase.

dispatchinvoice2.png

 

In the Target Form

Generate_Invoice_Number_in_Target_Form_with__INV_.png

[ top ]

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments