Variables "filter" argument not functioning as expected

Started by Tveloso, October 22, 2021, 02:48:45 AM

Previous topic - Next topic

Tveloso

Given this variable:

        {File.Categories|level:1}

...which returns this data for a file:

        Cache Status;Date Analysis;IMatch Workflow Categories;LivePhoto Clips;Location;People Counts

...I would expect either of these variables:

        {File.Categories|level:1;filter:^Live}
        {File.Categories|level:1;filter:Clips$}

...to return "LivePhoto Clips", but neither of those variables returns anything.  Only {File.Categories|level:1;filter:Live} returns that string.

Is it possible that the filter argument is not actually using regular expressions?...or might I have messed something up with the syntax?
--Tony

Mario

-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Tveloso

But it does work though, when the Filter term is not a regular Expression.

These variables:

        1.) {File.Categories|level:1;filter:^Live}
        2.) {File.Categories|level:1;filter:Live}
        3.) {File.Categories|level:1;filter:Clips$}

...return the following:

        1.) <nothing>
        2.) LivePhoto Clips
        3.) <nothing>

...so at first glance, it appears as though the use of a regular expression with the Filter argument is not working.

Or do you mean that the Filter argument is not actually processing the results of the Level argument, but is actually working with the entire category hierarchy for each category returned?...(that would explain why regular expressions do not appear to be working, since the actual category I'm interested in is actually *DataDriven|LivePhoto Clips|QT-CID|HasValue).

--Tony

Mario

It appears so. Basically its a

if first parameter is "filter"
  apply filter...
else if first parameter is "level"
  apply level...

I've implemented this years ago and I don't recall the exact why's and how's at this time.
I would need to set this up for debugging and step through, read the tests and documentation etc.
Since this works this way for years, and nobody else ever had problems with it, it's a are use-case etc., I would give this a very low priority
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

Tveloso

Thank you Mario.

It does appear to be applying them both, and I think this is working the way you intended...(it's just that both seem to be working with the "original" category in its entirety - and I was thinking along the lines of Renamer Steps, where each subsequent Step works with the results of the previous ones).

I have determined that it is in fact that Filter is working with each category in its entirety, and not the value returned by Level.

This variable:

        {File.Categories|filter:^\*DataDriven\|LivePhoto;level:1;substr:0,9}

...returns what I'm looking for...(I added the Substr argument, because I will have two categories that will match that regular expression, and I want them both to return the same value).

And the order in which the arguments are given doesn't appear to matter...these two variables:

        {File.Categories|filter:^\*DataDriven\|LivePhoto;level:1}
        {File.Categories|level:1;filter:^\*DataDriven\|LivePhoto}

...both return the same value (they both return the string "LivePhoto Clips").

Thank you Mario, for pointing me in the right direction.

I continue to be amazed by the power of IMatch!
--Tony

Mario

As I said, the parameter processing for categories and categories.direct is special and not part of the normal parameter processing workflow.
This is how I did implement this for IMatch 5 and it never changed...
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook