(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.data-privacy-src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-PF5R8F7');

Knowledge Base

Auto Increment/Decrement

Note: To use this feature, you must contact CodeREADr to activate middleware for your account and a minimum of a 10 device plan.

Scan a Barcode to Increase or Decrease a Numeric Value in a Database

The increment/decrement middleware feature provides a simple way to increase or decrease pre-assigned numeric values within the response text of a validation database.

The ability to increase or decrease those values based on a scan action can be useful for a variety of applications, such as inventory tracking – i.e. changing the quantity of inventoried items.

The scan action can simply be the result of a scan alone or it can be the result of the app-user entering a number within a post-scan prompt. Generally, you would configure one service to increment and another service to decrement the same values in a single, shared database.

Note: This feature changes the value in the validation database stored on CodeREADr.com. If you also have an inventory database in Excel, Sheets, or another database program, you can export this database as a CSV file to import elsewhere.


1. Create Service

Create a Validation Scans with a Database service type. Select ‘Online in Real-Time’. Then, select a database and make sure the status of duplicates is set to “Valid”. You can then click ‘Create Service’ at the bottom.

In naming the service, a good practice is to indicate whether it’s an Increase or a Decrease service.

Increment Service

2. Fixed Value of Increment/Decrement

Using this option, every scan the app-user makes will either increment or decrement the database value based on the Default you choose and Status you choose (All or Valid or Invalid).

middleware scan decrement

3. Variable increment/decrement based on the quantity input by the app-user

Using this option, the app-user enters a quantity when prompted after a scan. The increment or decrement will be based on that quantity.

When creating your service, under the Questions tab you add a question with the answer type Short Answer with numeric entry, or Multiple Choice/Dropdown with the answer options only containing numbers.

After creating this question, drag it to the “Ask After Submitting a Valid Scan” section of the questions menu then save your Question workflow.

On the Advanced step under the “Capturing – Edit middleware” header check “Increment/Decrement Value”. Here, you will choose ‘With Question” then choose the question you created and whether it increments or decrements the value in the database. You must then specify a delimiter.


Note: The first answer of a Dropdown question is automatically submitted so if ‘1’ is the most common answer then put that as your first answer.

4. Delimiter

There needs to be a delimiter so the app knows which value to change within the database’s response text. Generally the delimiter you choose should not be used in the response text anywhere except for this purpose. If it is, then it must be enclosed with brackets. It will then appear like this in your database and in the post-scan response:

  • Candy Bar {price}1.75{price}
  • 2×6 10’ Studs {amount}10{amount}

The delimiter can also be just a symbol such as an asterisk * or a bat | or a dash – or an underline _ all of which you can enter without brackets if not anywhere used else in the response text. Symbols will appear like this in your database and in the post-scan response:

  • The current bin quantity is *10*
  • Remaining _100_

5. Importing and Exporting Databases

On the Databases page, you can import, add, update and export your databases. For this feature, your database must have the delimiter in the response text (column 2) surrounding the numeric value to be incremented and/or decremented. When you submit a scan, that numeric value will be altered by the increment or decrement specified.

To get a history of the action taken you can view, filter, and export your scan records on the Scans page.

6. Add Another Value

This option allows you to have more than one value incremented or decremented within the same database. The delimiter will need to be different for each value.