filtering the results using variables in a data-driven category

Started by adamcooper, January 03, 2023, 06:37:36 PM

Previous topic - Next topic

adamcooper

Hello - I am very new to IMatch and appreciate your patience with this question.

How do I filter the results of a variable in a data-driven category?

I am attempting to filter the results of a data-driven category, using a variable {file.persons.group}

Currently, the values for this variable are:
GMI
IMBA
GMI/IMBA
Partners

I only want photos with confirmed faces to be displayed in each group. I typed {File.Faces.Confirmed|filter:yes} , but this is not working.

This is just one example of a few, and I have already tried the forums and the help articles. Maybe the answer is there, but I didn't understand it. This feels very advanced to me already. If there is a different way for me to reach my intended results, I would still like to know if it is possible to filter the results of a variable. I saw category filter in the menu, but I'm not sure how that is related.

Thanks!
Adam

Mario

Welcome to the community.

When you enter the variable {File.Faces.Confirmed} in the VarToy App (see IMatch App Overview) you can see that it returns Yes or No if you use IMatch wish English language settings.

If there are multiple faces in an image, it returns Yes|No for each face, e.g. Yes,No,No,Yes,Yes if there are 5 faces in the image and 3 are confirmed.

{File.Persons.Groups} returns a list of all groups for the persons in an image. If you have 3 persons in an image, it might return something like Family,Team,Family.

So, depending on whether or not your images only contain one face or multiple, your data-driven category might not work as you expect.

If you are sure that there is only one person per image, it will work.  Else maybe add the index:0 formatting function to take the first group from the list.

The Category Filter for data-driven categories does what the name implies: It filters for categories.
The category filter allows users to limit a data-driven category to files in one or more specified categories.
You cannot use a variable for this.


One idea to solve your rather advanced problem would be to use two data-driven categories: one data-driven category based on this variable:

{File.Faces.Confirmed|contains:Yes,Y,N}

This produces two child categories named Y and N, independent from the number of faces in an file.
It just checks if there is at least one Confirmed face and then adds the file to the Y child category, else to the N category.

Say we name this category ConfirmState.
Then ConfirmState|Y contains all files which have at least one confirmed face.

The second data-driven category is based on {File.Persons.Group} as before.
But this time, you can use the ConfirmState\|Y  category path as the category filter. This means that your person group category only considers files with at least one confirmed face.

I have not tried this (working mobile) but I guess it should work. Quick to do and to try out.

Notice from the future: IMatch 2023 allows persons to be in multiple groups. You might want to consider this.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

adamcooper

Dear Mario,

I can't believe that you wrote such a detailed response from a mobile device. Thank you. I will need to read through it another time and try your solution.

A follow-up question: How does the back-end of this statement work as it relates to a data-driven category?
{file.persons.group|filter:GMI}

|filter:GMI is probably completely incorrect, but it's my first time.

Can I use it to be more selective about the categories created? Could I use it to select the GMI group while ignoring the others?

Best,
Adam

Mario

Have you discovered the VarToy app yet?
You can enter your variables and see what the result is. This is way better than me trying to explain how variables work.
There is a (I think) good explanation of what filter does (with examples) in the documentation: filter:Regexp
Just try your variable with a few of your files (also some files with more than one person).

QuoteCan I use it to be more selective about the categories created?
For what? For the data-driven category based on {File.Persons.Group}?
Sure. You can filter the variable or you can filter the data-driven category values. See Filter Pattern in Advanced Data-driven Category Features and Options
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

adamcooper

Looking at the Variables webpage, I learned that I have been asking a syntax question about how to use the argument in a variable to solve my problem. I've seen the VarToy app, but I haven't learned how to make it useful for me. I need to study the documentation a bit more.

Thank you for pointing me to the "Filter Pattern" option. That's exactly what I needed. Now I can filter the values. Perfect!

These pages were also helpful.
https://www.photools.com/help/imatch/var_basics.htm
https://www.photools.com/help/imatch/rmh_regexp.htm

Mario

Just enter a variable into VarToy to see the result for the currently focused file in the File Window.
Very useful when you work with variable functions, formatters, filters etc.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook