counters.set(name, value, [counterFile]) Last updated: 30. May 2026

API only function

Sets a specific value for a named counter, stored in default or custom location. Used for initializing or correcting counter values.

Parameters

Name Type Description
name string

The unique identifier or name of the counter to set. Must be a non-empty string.

value integer

The integer value to set the counter to. Must be a number.

counterFile (optional) string

Absolute file path to counter file.
Default is "#/counters.json" if not specified.

Returns

True if updated, otherwise false.

Example

Code example (JS)

JS is normal JavaScript either running in the browser or on the Docly™ server.
// Sets the counter "Ticketno" to 10
counters.set("Ticketno", 10);