# Simple syntax issues on If statement

**URL:** <https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206>\
**Category:** Support\
**Created:** [May 4, 2022, 3:08pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206 "2022-05-04T15:08:40Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![HellPhantom](https://community.mp3tag.de/user_avatar/community.mp3tag.de/hellphantom/32/9565_2.png) [@HellPhantom](https://community.mp3tag.de/u/HellPhantom)\
**Post date:** [May 4, 2022, 3:08pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/1 "2022-05-04T15:08:40Z")

</div>

Hi I cant seem to format this simple statement correctly.  
I want to look if the movie filename contains a string 'Rifftrax' and if it does then I would like to add it to existing album (collections) as an additional album. %album%/Rifftrax.

I am not understanding the if statement correctly when it comes to **contain**.

I have been working of this syntaxes I found but can't get it working.  
$if($eql($strstr(%\_filename%,ShowA),1),Political,%genre%)  
and  
$ifgreater($strstr(%field%,$char(34)),0,yes,no)"

My current try (not working)  
I am using:  
Format value  
Field: ALBUM  
Format String: $if($has($strstr(%\_filename%,$Rifftrax)),%album%/Rifftrax,%album%)

Please help.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [May 4, 2022, 3:15pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/2 "2022-05-04T15:15:52Z")

</div>

> [@HellPhantom](#):
>
> $has

is no MP3tag statement/function.  
`$ifgreater($strstr(%_filename%,Rifftrax),0,%album%/Rifftrax,%album%)`

And what could

> [@HellPhantom](#):
>
> $Rifftrax

be?

---

<div class="post-metadata">

**Author:** ![HellPhantom](https://community.mp3tag.de/user_avatar/community.mp3tag.de/hellphantom/32/9565_2.png) [@HellPhantom](https://community.mp3tag.de/u/HellPhantom)\
**Post date:** [May 4, 2022, 6:23pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/3 "2022-05-04T18:23:04Z")

</div>

I use Filebot to format and make my filenames, and rifftrax is an audio track or a commentary track. If i could get one working if statement that looks for **any occurance** not case sensative of a value in a field I should be good.

---

<div class="post-metadata">

**Author:** ![HellPhantom](https://community.mp3tag.de/user_avatar/community.mp3tag.de/hellphantom/32/9565_2.png) [@HellPhantom](https://community.mp3tag.de/u/HellPhantom)\
**Post date:** [May 4, 2022, 6:25pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/4 "2022-05-04T18:25:32Z")

</div>

> [@ohrenkino](#):
>
> what

I got it from this page. [Filter and Search – Mp3tag Documentation](https://docs.mp3tag.de/filter/)

this portion.

## Notes

- If `<field>` or `<string>` contains spaces, it should be enclosed in double quotation marks, e.g., `artist IS "Hidden Orchestra"`.
- If `<field>` in HAS/IS/GREATER/LESS/EQUAL/MATCHES contains `$` or `%` it should be enclosed in double quotation marks and will be treated as a [format string](https://docs.mp3tag.de/format) instead of a tag field name. This will decrease search speed on large libraries since the format strings need to be evaluated before filtering.
- It is not possible to filter by strings containing double quotations marks. This is a limitation of the feature.
- To filter for fields containing double quotation marks, use `"$ifgreater($strstr(%field%,$char(34)),0,yes,no)" IS yes` or  
`field MATCHES \"`
- All operations are non-case sensitive. All filter keywords must be uppercase.

Anyway.

---

<div class="post-metadata">

**Author:** ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)\
**Post date:** [May 4, 2022, 6:28pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/5 "2022-05-04T18:28:03Z")

</div>

The filter syntax has nothing (or not a lot) to do with the scripting functions. And even if you could use it, then the pure filter syntax would be HAS (all capitals, no $).

Did you try my suggestion? What was the result?

---

<div class="post-metadata">

**Author:** ![HellPhantom](https://community.mp3tag.de/user_avatar/community.mp3tag.de/hellphantom/32/9565_2.png) [@HellPhantom](https://community.mp3tag.de/u/HellPhantom)\
**Post date:** [May 4, 2022, 6:44pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/6 "2022-05-04T18:44:12Z")

</div>

Thanks very much it works just 100% now.

I had it exactly like this at one point and it was so close but I removed the .upper because I was struggling and not sure what the syntax must really be, i was guessing and when it compared it with my upper RIFFTRAX it did not work and I thought I just had the syntax wrong so I kept changing things. I want to upper filename and then compare to upper RIFFTRAX to make sure they are all cought.

It really helps when someone really knows what the syntax should really be. The syntax word **greater** also sounded incorrect to me, I was looking for another operator.

$ifgreater($strstr(%\_filename%,RIFFTRAX),0,%album%/Rifftrax,%album%). (my one that did not work because of case)

I think this one will work fine for me.

$ifgreater($strstr(%\_filename%.upper,RIFFTRAX),0,%album%/Rifftrax,%album%)

Thanks you so much for quickly responding and helping me.

---

<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:** [June 3, 2022, 6:44pm UTC](https://community.mp3tag.de/t/simple-syntax-issues-on-if-statement/57206/7 "2022-06-03T18:44:36Z")

</div>

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