How to implement?

Give me a hint on how to do it. I don’t know what the correct name is, maybe counter).
image

Number field, two icons/buttons with workflow doing [number_input.value]+1 and for subtraction is the same thing [number_input.value]-1

1 Like

Thanks, I did it.
How do I limit it, so it doesn’t show less than 1?

I’d go with some javascript formula like

([number_input.value] < 1) ? 1 : ([number_input.value] -1) 
//(is number is less than 1) ? if yes return 1 : (else return calculation)

Here?

I’d do it in the [-] icon workflow.

It went like this:

// Check if the variable value is less than 1
if ([number_input-value] < 1) {
  // If it is, return 1
  return 1;
} else {
  // If it's not, subtract 1 from the variable value and return the result
  return variables [number_input-value] - 1;
}

When I press “-” it becomes 0, when I press again it becomes 1.

Check this out :slight_smile:

Reference to the Conditional (ternary) operator - JavaScript | MDN

1 Like

Thank you very much for the explanation.