# \[X\] max\_counter can give value of wrong loop

**URL:** https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700
**Category:** No Bugs
**Created:** [November 5, 2007, 9:58am UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700 "2007-11-05T09:58:11Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 5, 2007, 9:58am UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700/1 "2007-11-05T09:58:11Z")

</div>

%\_max\_counter% can give the value for the wrong loop. E.g. whereas the last line of the output of the Export script

```
-- nested loops
$loop(%_directory%)$loop(%_filename%)%_directory%/%_filename%
$loopend()$loopend()
-- single loop
$loop(%_filename%)%_directory%/%_filename%
$loopend()
max_counter: %_max_counter% (i.e. %_max_counter%)

```

should be e.g.

```
-- nested loops
a/x
a/x
b/y
b/y
c/z
c/z

-- single loop
a/x
a/x
b/y
b/y
c/z
c/z

max_counter: 6 (i.e. 6)

```

instead it is

```
...
max_counter: 3 (i.e. 6)

```

max\_counter can also erroneously return null:

```
-- nested loops
$loop(%_directory%)$loop(%_filename%)%_directory%/%_filename%
$loopend()$loopend()
max_counter: %_max_counter% (i.e. %_max_counter%)

```

gives e.g.

```
-- nested loops
a/x
a/x
b/y
b/y
c/z
c/z

max_counter: 3 (i.e. )
```

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [November 7, 2007, 6:54pm UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700/2 "2007-11-07T18:54:55Z")

</div>

It's only evaluated once for each top-level loop.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [November 11, 2007, 10:46am UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700/3 "2007-11-11T10:46:34Z")

</div>

It is supposed to return the "Maximum value of counter of the last closed loop" ([https://docs.mp3tag.de/export](https://docs.mp3tag.de/export)) but is failing to do so.

---

<div class="post-metadata">

### Author: ![chrisjj](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/c/a698b9/32.png) [@chrisjj](https://community.mp3tag.de/u/chrisjj)
#### Post date: [February 3, 2008, 2:10pm UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700/4 "2008-02-03T14:10:22Z")

</div>

Please?

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [December 28, 2018, 2:20pm UTC](https://community.mp3tag.de/t/x-max-counter-can-give-value-of-wrong-loop/5700/5 "2018-12-28T14:20:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
