counters.set(name, value, [counterFile]) Last updated: 10. Dec 2024

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 or false

Example

Code example (JS)

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