Increment step

This feature request is for adding a server-side step to allow incrementing integers, without using Set Value

The increment step would accept the variable name as the input (through the Data Binding Picker) and would re-set such variable (incremented) following the original’s properties

An increment value could also be optionally supplied (if different than 1)

A question related to this: how to set variables or objects in current SA context via Custom Extension?
@patrick
If that would be possible, an increment step could be made as a custom extension.

One use case I had sometime ago led to using sessions for storing data ‘globally’.

I often use sessions for global variables as the global name in set value has to be entered manually so its easier

I meant global in sense of the Server Action being executed. Not Wapler Globals.

It’s probably easy to create by copying the “Set Value” function from the core and adding the increment logic.

That’s where I would start.

setvalue: function(options) {
        let key = this.parseOptional(options.key, 'string', '');
        let value = this.parse(options.value);
        if (key) this.set(key, value);
        return value;
    },
App.prototype = {
    set: function(key, value) {
        this.global.set(key, value);
    },
1 Like

Ah yes!
Did not think of looking into the code. That should probably work.