# Support for Function Composition within Filters

**URL:** <https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730>\
**Category:** Support\
**Created:** [March 18, 2022, 5:51pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730 "2022-03-18T17:51:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![qjstuart](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@qjstuart](https://community.mp3tag.de/u/qjstuart)\
**Post date:** [March 18, 2022, 5:51pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/1 "2022-03-18T17:51:12Z")

</div>

Consider the AND filter function in mp3tag. Here is a working example of an expression which returns tracks from my F drive with missing covers:

_(%\_path% HAS "F:") AND (%\_covers% MISSING)_

Now, I would like to add another criterion: I want my filter to also return tracks from my F drive with covers. So the filter now should return tracks from F drive with missing covers and tracks from E drive with covers. However, the following expression does not work:

_((%\_path% HAS "F:") AND (%\_covers% MISSING)) AND ((%\_path% HAS "E:") AND (%\_covers% HAS 1))_

It seems that expressions cannot be composed in such a way, is this correct? If so, is there any workaround to achieve this _((w AND x) AND (y AND z))_ functionality?

Thanks,  
Quentin

---

<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:** [March 18, 2022, 5:57pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/2 "2022-03-18T17:57:48Z")

</div>

> [@qjstuart](#):
>
> _((w AND x) AND (y AND z))_ functionality?

Yes.  
Yet, I think that the middle AND is (logically) not correct. It should be an OR.  
(I mean the files cannot be both - be from drive f and e and also have covers and haven't)

So try:  
`(%_path% HAS "F:" AND %_covers% MISSING) OR (%_path% HAS "E:" AND %_covers% PRESENT))`

---

<div class="post-metadata">

**Author:** ![qjstuart](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@qjstuart](https://community.mp3tag.de/u/qjstuart)\
**Post date:** [March 18, 2022, 6:04pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/3 "2022-03-18T18:04:16Z")

</div>

> [@ohrenkino](#):
>
> `(%_path% HAS "F:" AND %_covers% MISSING) OR (%_path% HAS "E:" AND %_covers% PRESENT))`

You're right! Just needed to change the middle AND to OR. Also, thanks for the suggestion to use _(%\_covers% PRESENT)_ instead of _(%\_covers% HAS 1)_. For anyone wondering what the difference is, the former will return all tracks with any amount of covers whereas the latter will return tracks with _n_ covers where _n_ contains the digit 1. For example: 1, 10, 21, 141 etc.

Thank you very much, big up!

---

<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:** [March 18, 2022, 6:12pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/4 "2022-03-18T18:12:24Z")

</div>

> [@qjstuart](#):
>
> whereas the latter will only return tracks with 1 cover.

Not quite. It will return any amount of covers that includes the digit 1, so theoretically 10, 11, 12 ... 19, 21 would also be included.  
If you want to limit the number of covers to exactly 1 then use  
`%_covers% IS 1`

More on filters can be found in the documentation:

> **[Filter and Search – Mp3tag Documentation](https://docs.mp3tag.de/filter/)**
>
> Documentation on Filter and Search and keywords to form complex filter expressions. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

**Author:** ![qjstuart](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/q/d07c76/32.png) [@qjstuart](https://community.mp3tag.de/u/qjstuart)\
**Post date:** [March 18, 2022, 6:19pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/5 "2022-03-18T18:19:42Z")

</div>

True, updating my previous reply to reflect this. Thanks again!

---

<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:** [April 17, 2022, 6:20pm UTC](https://community.mp3tag.de/t/support-for-function-composition-within-filters/56730/6 "2022-04-17T18:20:43Z")

</div>

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