Incrementing variables in Edge

Is it possible to increment a variable in edge?

@set('counter', 0)

then at some point i increment it if it satisfies a condition

@if(somefield == 'some value')
**@set('counter', counter+1)**

Many thanks for any tips!!

Hi @evangarde and welcome to community!

Just to be sure, Edge code runs only when you are loading page / refreshing. It does not run on client side like Vue / React / Angular etc, do you want to add to counter with each refresh?

1 Like

hi, v good point you made there about the counter being incremented at each refresh. {{ Thus hence the thought of putting @set(‘counter’, 0) upon each refresh before counting }}. Nevetheless, to make the solution simple I actually implemented it using just another field in the DB and simply displayed that column :slight_smile:

1 Like