photools.com Community

IMatch Bug Reports and Feature Requests => Bug Reports => Solved Bug Reports (for next version) => Topic started by: axel.hennig on October 04, 2023, 09:38:09 PM

Title: Variable working in VarToy but not in Category Formula
Post by: axel.hennig on October 04, 2023, 09:38:09 PM
I've got a Variable

{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:YYYY-MM-DD;datecomp:gt,2008-01-01,TRUE,FALSE}
which works fine in the VarToy-App, but if enter

"@Variable[{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:YYYY-MM-DD;datecomp:gt,2008-01-01,TRUE,FALSE},hasvalue]"
it returns: Error Code: [15000]; Invalid expression

What am I doing wrong?

If I enter

"@Variable[{File.MD.XMP::photoshop\DateCreated\DateCreated\0|format:YYYY-MM-DD},hasvalue]"
it works.
Title: Re: Variable working in VarToy but not in Category Formula
Post by: Mario on October 05, 2023, 10:18:06 AM
It's the commas that breaks this. Commas are used in Category formulas to separate parameters.
There is no special case for @Variables with variables containing functions with , the implementation I've settled for aims at speed, not at dealing with every possible use case. This is important since @Variable has to be parsed and executed for every file in the database every time.

Since this worked for so long without a problem report, I think not many users will ever use @Variables, or only with simple expressions. I could implement a more complex parser that parses the variable, looking for the final closing } instead of just using , as the Category formula parameter separator, but I have no idea what this would do with the performance. It would be a lot slower I think. Need to think about this.

I'll move this as alow-prio into bug reports for now.
Title: Re: Variable working in VarToy but not in Category Formula
Post by: Mario on October 05, 2023, 05:53:09 PM
I have fixed this for IMatch 2023.3.6 (out just now).
Title: Re: Variable working in VarToy but not in Category Formula
Post by: axel.hennig on October 05, 2023, 07:27:37 PM
Thanks