photools.com Community

IMatch Discussion Boards => General Discussion and Questions => Topic started by: Darius1968 on May 27, 2023, 04:45:55 PM

Title: Variable won't return # categories for a file
Post by: Darius1968 on May 27, 2023, 04:45:55 PM
So, I I try {File.Categories|count:true} in VarToy, only to have 1 or 0 returned for a given file - I'm getting confirmation that said file(s) have categories, but not how many.  So, what is wrong here? 
Title: Re: Variable won't return # categories for a file
Post by: Mario on May 27, 2023, 05:03:04 PM
Works here.

{File.Categories|filter:^Color}
{File.Categories|filter:^Color;count:true}

Returns

Colors|Red;Colors|Green
2

in my test case.

The 2023 release notes have one related entry:

#1863
Variables and Count/Sum/Avg
These functions are now supported for normal variables, not only for repeatable metadata values and category variables.

I currently have no IMatch 2021 version running anywhere so I cannot test if count worked correctly in that version.
Maybe another user can try this?
Title: Re: Variable won't return # categories for a file
Post by: Darius1968 on May 27, 2023, 05:24:37 PM
I'm able to get this function to work only with the addition of a filter: argument.  Is that also the case on your end? 

This works:
{File.Categories|filter:.;count:true}
This doesn't:
{File.Categories|count:true}

Title: Re: Variable won't return # categories for a file
Post by: axel.hennig on May 27, 2023, 08:43:29 PM
Works here (see screenshot).

sc1.jpg
Title: Re: Variable won't return # categories for a file
Post by: thrinn on May 27, 2023, 10:51:25 PM
Works for me also. No need to add a filter.