Fieldpine Logo Documentation Home  
POS Commands Home

The hardtotal command allows systems to reference read only values and sequential values such as counters. It originates from older cash register technology where totals would be added to a permanent counter that could not be reset. Typically this was used for audit purposes. It is also seen in devices, such as printers, which record statistics about operation which cannot be reset.

Technically, this is not a PosCommand, but a symbol. It is documented as a PosCommand however as it is more complex than typical symbols. It also differs from other symbols as when a hardtotal is accessed it causes the value to be increased. Most symbols do not have side effects like this.

Commnd Overview

%hardtotal.user.name%
Reads and increases the hardtotal name. You can create many different hardtotal counters. Name can only contain the characters A..Z and 0..9
%hardtotal.user.read.name%
Reads the hardtotal without causing it to increment
%hardtotal.physkey%
(9 Apr 2016, P1918) Fetchs a new unique physkey value. A physkey is a globally unique value much like a UUID or GUID. It consists of a series of numbers and letters.

Example

	set t1 = %hardtotal.user.batchno%	-- gets a value (eg 4)
	set b1 = %hardtotal.user.read.batchno%	-- re reads the current value
	set b2 = %hardtotal.user.read.batchno%	-- again a re read. Value is still 4

	set t2 = %hardtotal.user.batchno%	-- gets next value (5)
	set c1 = %hardtotal.user.read.batchno%	-- re reads as 5

	set aKey = %hardtotal.physkey%	-- get a globally unique value

Implementation

Windows

The hardtotals are stored in the database table counters. Each counter is specific to a location and has current (stored in "value" column), minimum and maximum values. A valid location id must be provided, location 0 cannot be used.

A counter must exist in the counters table before it can return a value. Randomly reading an unknown counter eg hardtotal.user.doesnotexist, is considered an error

When counters reach the maximum value, they read as empty-string

Availability

FunctionWindowsAndroidWebMesh
Hardtotal Yes No No No

Hard totals are by definition a device specific counter. This makes them harder to use in a shared way inside a fully distributed system operating in offline mode. Two machines might have the same starting value (say 4) and both need to increase to 5, but if no connection exists between them, they cannot increase and have a unique value. There are solutions to this problem if required.