Click or drag to resize

ICounterApiNext Method

Generate an auto-incremented integer for a given sequence.

Namespace:  Casewhere.Runtime.DSL.Api
Assembly:  Casewhere.Runtime (in Casewhere.Runtime.dll) Version: 2.8.1.0
Syntax
C#
int Next(
	string name
)

Parameters

name
Type: SystemString
Name of the counter.

Return Value

Type: Int32
The generated number.
Examples
var counterApi = ctx.Use<ICounterApi>();
// This example generates a new Order Number for the current year
var orderNo1 = counterApi.Next($"OrderNo_{DateTime.Now.Year}"); // return 1
var orderNo2 = counterApi.Next($"OrderNo_{DateTime.Now.Year}"); // return 2
var receiptNo = counterApi.Next($"ReceiptNo_{DateTime.Now.Year}"); // return 1
See Also