How to make a "counter" for variables

Updated 2 weeks ago by Fran

Easy solution to set up a counter/loop to add up variables

Before beginning, you can check a demo in here.

In this example we will create a counter with a variable called @score. Our flow should look something like this:

  1. Create the variable @score with a Set A Variable block, with a  Number format and a value of 0:
  2. Once the step that needs to be counted has passed, we add another Set A Variable block using the same variable but with calculations:

Bear in mind that when working with numbers, Landbot adds 1 decimal. So even if you establish 0 or 1, it will become 0.0 or 1.0. In case you are working with conditionals, you need to work with decimals too. Example "if @score = 1.0"
These scripts and how to's are not native functionalities. Landbot won't be able to support, help or guarantee these scripts and how to's. These Workarounds and How to's are for developers, as a learning and example material on how to extend or modify some of the platform limitations.  Due to platform updates, some scripts might stop working in the future.Please, note that in case of Scripts and Workaround the Custom Success Team can deliver limited support.


How did we do?