OLD BUILDER - How to make a "counter" for variables
This article corresponds to the V2 (Classic) of the app. You can check the equivalent for the new version V3 (Bricks) here
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:
- Create the variable @score with a Set A Variable block, with a Number format and a value of 0:
- 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.