Custom column to select subset of tags

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Custom column to select subset of tags

Post by kkonstantinidis »

Hi, I am using the Tags column to tag my files. Now, I want to create a new custom column that for each file in the current view shows only a subset of tags that I have selected in advance.

For example, assume that my tags are:
red,green,blue,square,rectangle
I want to have a new column named Shape that displays only the tags "square" and "rectangle" for each file (depending on whether any of these 2 tags are on the file). Ideally, I want this column to be computed based on the Tags column so that I do not need to maintain both of them.

I have tried Right click on the top bar > Add Column > Right click on the column > Select Custom Column... > OK > Right click on the column > Configure Custom Column 16... . I suspect that its Type has to be Script but I don't know how to configure it.

Any ideas if this is possible and how I can do it?

highend
Posts: 14926
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Custom column to select subset of tags

Post by highend »

Code: Select all

$tags = tagitems("tags", , <cc_item>);
    $matches = regexmatches($tags, "(square|rectangle)", ",");
    if ($matches) { return $matches; }
One of my scripts helped you out? Please donate via Paypal

kkonstantinidis
Posts: 20
Joined: 15 Jan 2020 01:45

Re: Custom column to select subset of tags

Post by kkonstantinidis »

highend wrote: 25 Feb 2023 22:07

Code: Select all

$tags = tagitems("tags", , <cc_item>);
    $matches = regexmatches($tags, "(square|rectangle)", ",");
    if ($matches) { return $matches; }
Thanks @highend, it worked like a charm!

Post Reply