# How can I create a custom column and get a conditional word as text?

**URL:** <https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518>\
**Category:** Support\
**Created:** [October 23, 2023, 11:48am UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518 "2023-10-23T11:48:01Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simos\_Sigma](https://community.mp3tag.de/user_avatar/community.mp3tag.de/simos_sigma/32/9966_2.png) [@Simos\_Sigma](https://community.mp3tag.de/u/Simos_Sigma)\
**Post date:** [October 23, 2023, 11:48am UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/1 "2023-10-23T11:48:01Z")

</div>

Hello community!

I am using the following code `$if($eql($strstr(%_folderpath%,Archived),0),Archived,Not)` to create a custom column named "State" and assigns the word "Archived" if the folder path of the file contains the word "Archived".

 ![Screenshot 2023-10-23 143924](https://community.mp3tag.de/uploads/default/original/2X/f/fd5189d61e4d9b4fc49cbec35731439a430ec82c.png)

Now, I want to assign the words "Archived", "Uncategorized", or "Unchecked" if the folder path of the file contains any of these words. If none of these words are present in the folder path, I want to assign the word "Nothing". Is this possible?

Thank you for your time!

---

<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:** [October 23, 2023, 12:11pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/2 "2023-10-23T12:11:29Z")

</div>

> [@Simos\_Sigma](#):
>
> $if($eql($strstr(%\_folderpath%,Archived),0),Archived,Not)

Something like  
`$ifgreater($strstr($replace(%_folderpath%,Archived,xxxxx,Uncategorized,xxxxx,Unchecked,xxxxx),xxxxx),0,Nothing,-)`

---

<div class="post-metadata">

**Author:** ![Simos\_Sigma](https://community.mp3tag.de/user_avatar/community.mp3tag.de/simos_sigma/32/9966_2.png) [@Simos\_Sigma](https://community.mp3tag.de/u/Simos_Sigma)\
**Post date:** [October 23, 2023, 1:19pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/3 "2023-10-23T13:19:04Z")

</div>

I can't make it work... 🙁  
Can you please explain what this line of code does, part by part?

---

<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:** [October 23, 2023, 1:27pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/4 "2023-10-23T13:27:01Z")

</div>

It checks whether there is a string xxxxx somewhere in the %\_Folderpath% after the keywords you have supplied have been replaced by xxxxx.  
Your description lacks what should be done if there is no hit - I assumed the `-` as a good display.

You can test the expression in Convert\>Tag-Tag and see whether it produces the correct result or what the difference between the code and the data could be.  
Screenshots help a lot.

For the general proceeding:  
If you want to treat the file afterwards - wouldn't a filter be much easier to handle? It is not clear to me what you do with the data in the new column.

---

<div class="post-metadata">

**Author:** ![LyricsLover](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/l/c6cbf5/32.png) [@LyricsLover](https://community.mp3tag.de/u/LyricsLover)\
**Post date:** [October 23, 2023, 1:38pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/5 "2023-10-23T13:38:14Z")

</div>

> [@Simos\_Sigma](#):
>
> Can you please explain what this line of code does, part by part?

The basic formula would be  
`$ifgreater($strstr(%_folderpath%,Archived),0,found,not found)`  
If the position of the word `Archived` in the current folderpath will be greater then 0, then return _found_, else return _not found_.

As you like to see at least 4 possible variants, you would have to cascade this formula.  
This becomes pretty illegible:  
`$ifgreater($strstr(%_folderpath%,Archived),0,found1,$ifgreater($strstr(%_folderpath%,Uncategorized),0,found2,$ifgreater($strstr(%_folderpath%,Unchecked),0,found3,everything else)))`

---

<div class="post-metadata">

**Author:** ![Simos\_Sigma](https://community.mp3tag.de/user_avatar/community.mp3tag.de/simos_sigma/32/9966_2.png) [@Simos\_Sigma](https://community.mp3tag.de/u/Simos_Sigma)\
**Post date:** [October 23, 2023, 2:02pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/6 "2023-10-23T14:02:30Z")

</div>

> [@LyricsLover](#):
>
> $ifgreater($strstr(%\_folderpath%,Archived),0,found1,$ifgreater($strstr(%\_folderpath%,Uncategorized),0,found2,$ifgreater($strstr(%\_folderpath%,Unchecked),0,found3,everything else)))

It worked!!! 🙂

After I broke it, it became more readable and understandable...

```auto
$ifgreater($strstr(%_folderpath%,Archived),0,found1,
$ifgreater($strstr(%_folderpath%,Uncategorized),0,found2,
$ifgreater($strstr(%_folderpath%,Unchecked),0,found3,
everything else)))

```

I edited it and then I just had to make it one line again in order to place it into the "Value" field.

Thank you very much both for your help!!! 🙂

---

<div class="post-metadata">

**Author:** ![Simos\_Sigma](https://community.mp3tag.de/user_avatar/community.mp3tag.de/simos_sigma/32/9966_2.png) [@Simos\_Sigma](https://community.mp3tag.de/u/Simos_Sigma)\
**Post date:** [October 23, 2023, 2:25pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/7 "2023-10-23T14:25:23Z")

</div>

I have a small issue...

When it prints `found1` into "State" column everything is fine. But when it prints `found2` looks like this "\_\_found2" and for `found3` like this "\_\_\_\_found3". It adds two spaces for `found2` and four spaces for `found3`. Any idea why is this happening?

I added lines just to demonstrate the spaces.

---

<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:** [October 23, 2023, 2:27pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/8 "2023-10-23T14:27:23Z")

</div>

> [@Simos\_Sigma](#):
>
> It adds two spaces for `found2` and four spaces for `found3`. Any idea why is this happening?

You have to check your code for extra spaces following commas. If you look at @LyricsLover 's original code, there is not a single space.

---

<div class="post-metadata">

**Author:** ![Simos\_Sigma](https://community.mp3tag.de/user_avatar/community.mp3tag.de/simos_sigma/32/9966_2.png) [@Simos\_Sigma](https://community.mp3tag.de/u/Simos_Sigma)\
**Post date:** [October 23, 2023, 2:40pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/10 "2023-10-23T14:40:01Z")

</div>

You are right 100%!!! 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:** [November 22, 2023, 2:40pm UTC](https://community.mp3tag.de/t/how-can-i-create-a-custom-column-and-get-a-conditional-word-as-text/62518/11 "2023-11-22T14:40:53Z")

</div>

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