Views:

Product: LABELVIEW, CODESOFT
Version: All Versions

About Counter Variables

What is a Counter Variable?

A counter variable is a data source that automatically increments or decrements based on defined settings such as a start value, increment value, and reset conditions.

NOTE: A negative increment value causes the counter to decrease. An increment value of zero creates a fixed (non-changing) value.

Why Use a Counter Variable?

Counter variables are commonly used for sequential numbering, such as serial numbers, lot numbers, or production tracking.

They ensure each printed label (or group of labels) contains a unique value.


Creating a Counter Variable

Available Properties

Counter Properties include:

  • ISO counter
  • Base calculation type
  • Increment value
  • Start value
  • Reset value
  • Increment timing

Output Properties include:

  • Prefix / Suffix
  • Output mask
  • Decimal formatting
  • Padding characters
  • Log file inclusion

Procedure

1. In the Data Sources window, right-click Counter and select Add.
Alternatively, go to Data Source → Counter → Add from the top toolbar.

2. A new counter variable (e.g., Counter0) is created. Select the Counter tab to configure it.

3. Configure the Counter tab:
  • Name: Assign a meaningful name
  • Shared Variable: Saves value externally for reuse (LABELVIEW Gold / all CODESOFT versions)
  • ISO Counter: Counts every printed label
  • Type: Defines counting base (Decimal by default)
  • Current Value: Starting value
  • Increment: Value added or subtracted each cycle

NOTE: Adding an asterisk (*) to the increment forces it to follow the counter base.

  • Min/Max Value: Defines reset range
  • Increment After: Controls when increment occurs
  • Having Printed: Number of labels before increment
  • Each Reset Of: Link increments to another counter
  • Reset After Variable Change: Resets on cycle events (e.g., weekly/monthly)

4. Configure the Output tab:
  • Prefix / Suffix: Add characters before/after the value
  • Output Mask: Format display
  • Display Decimals: Enable decimal formatting
  • Number of Decimals: Set precision
  • Decimal / Thousand Separator: Customize formatting
  • Pad With: Add leading characters (e.g., 0012)
  • Max Characters: Define total field length
  • Include in Log File: Track printed values
  • Accumulate Value: Store and add values across jobs

5. (Optional) Use the Visual Basic Scripting tab (available in LABELVIEW Gold and all CODESOFT versions):
  • Activate Event Call: Enable scripting
  • Events: Select script trigger points
  • Script Editor: Enter VBScript code
  • Test Button: Validate script

For more details, click the Help button within the Visual Basic Scripting tab.