Negative index in expressions

Started by DigPeter, January 30, 2014, 07:22:54 PM

Previous topic - Next topic

DigPeter

I am using expressions such as: {File.Categories|filter:Subject;level:3}, for instance in the category A|B|C|D this would give C

Could an element be  designated counting from the bottom by using a negative index;  that is {File.Categories|filter:Subject;level:-2}, again to give C? 

It would be useful, where the number of elements vary under a common top node, so that, for instance, the one second from bottom could be selected, irrespective of the number of nodes in  the category.  So with expression {File.Categories|filter:Subject;level:-2}:  for Subject|B|C, 'B' would be selected and for Subject|D|E|F, 'E' would be selected.

Mario

Added for the build 5.0.138. I was working on variables today and this one was not hard to do.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook