Numbering a tagfield from 1 to 7 repeatedly

I would like to write value X in a tagfield of subsequent mp3 files of a folder with 10.000 mp3 files while:
At start X=0
If X ≠ 7 then X = X+1
else X=1
In case I can achieve this with MP3 tag, how?

It can be achieved with %_counter% and some boolean and arithmetic functions:

if you use just %_counter%, start would be at 1
$sub(%_counter%,1) starts with 0

did I understand you right? strange numbering...

Numbering a tagfield from 1 to 7 repeatedly.
Actiontype 5: Format value
Formatstring: $add($mod($sub(%_COUNTER%,1),7),1)