# Function to check if Track Number is empty

**URL:** https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680
**Category:** Support
**Created:** [July 24, 2012, 8:29am UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680 "2012-07-24T08:29:38Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tiefighter88](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/eb9ed0/32.png) [@tiefighter88](https://community.mp3tag.de/u/tiefighter88)
#### Post date: [July 24, 2012, 8:29am UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680/1 "2012-07-24T08:29:38Z")

</div>

Having difficulty getting this formula right, I have searched the forums and couldn't find any threads with the same issue I am experiencing.

I want to assign to Tag-to-Filename , using a function that will apply a Track number before the Title IF there is a number present in the Track Number field.

As of now with an empty Track Number using, %genre%\%album%$num(%track%,2) - %title%

I get the zeros into the filename: "00 - Track.mp3"

Since not all of my mp3's have Track listing details, I don't want the 00's popping up everywhere...

What function can I use to check the Track Number field? So if the Track Number is blank, the filename yields: "Track.mp3"

---

<div class="post-metadata">

### Author: ![dano](https://community.mp3tag.de/user_avatar/community.mp3tag.de/dano/32/6_2.png) [@dano](https://community.mp3tag.de/u/dano)
#### Post date: [July 24, 2012, 8:32am UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680/2 "2012-07-24T08:32:38Z")

</div>

[$num(%track%,2) -]%title%

If you put code in square brackets, it will only be returned if at least one placeholder inside is not empty.

---

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [July 24, 2012, 1:02pm UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680/3 "2012-07-24T13:02:21Z")

</div>

> [@tiefighter88](#):
>
> ... I have searched the forums and couldn't find any threads with the same issue I am experiencing. ... What function can I use to check the Track Number field? So if the Track Number is blank, the filename yields: "Track.mp3"

Question is already answered by dano in post #2, but for your interest here are more variants of the same old theme.

**$if(%TRACK%,$num(%TRACK%,2)' - '%TITLE%,%TITLE%) $if(%TRACK%,$num(%TRACK%,2)' - ',)%TITLE% [$num(%TRACK%,2)' - ']%TITLE%**

DD.20120724.1700.CEST  
DD.20131107.1845.CET

---

<div class="post-metadata">

### Author: ![tiefighter88](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/t/eb9ed0/32.png) [@tiefighter88](https://community.mp3tag.de/u/tiefighter88)
#### Post date: [July 24, 2012, 8:10pm UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680/4 "2012-07-24T20:10:35Z")

</div>

LEGENDS!!! THANK YOU VERY MUCH

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:23pm UTC](https://community.mp3tag.de/t/function-to-check-if-track-number-is-empty/13680/5 "2026-02-09T12:23:58Z")

</div>


