I have a json array of objets. the following code display something like "2/project" indicating that the name I am looking (variable "ref") for is at index 2.
<$list variable=ref filter="[<proj>indexes[]addsuffix[/project]]">
<$set name=chk filter="[<proj>getindex<ref>match<pid>then<ref>]">
<<chk>>
</$set>
</$list>
The following code just display the project value I want, but it has got it by inspecting the <number>/project references.
{{{
[<proj>indexes[]addsuffix[/project]filter[indexing<proj>match<pid>]]
}}}
(I am not looking to use it as a {{{ filter }}}, this is just for testing.)
indexing is a filter operator of mine such that [a]indexing[b] is the same as [b]getindex[a]
(for instance, {{{ [<proj>indexes[]indexing<proj> }}} will display (individually) all the indexed objects of the <proj> tiddler)
it's very useful, because I often build my index, but can't use it within my filter if it was not for this very operator! And remaining in the filter is a way to keep things simple (no need for boilerplate <$list>)
with this code so far so good, here is the next step: use the "filter" operator to select the good combination but instead display the reference like 2/project.
Here it is (the variable "pid" contains the project code name I am looking for):
<$set name=x filter="[<proj>indexes[]addsuffix[/project]filter[indexing<proj>match<pid>]]">
x = <<x>>
</$set>
but the result is
x = 0/project 1/project 2/project
"filter" has not selected anything.
I have developed a "dump" filter operator showing the titles waiting for the next operator in the javascript console. Nothing is shown there, indicating that the subfilter has never been called.
What's going on?
Just to be sure it's not something with my "indexing" operator, I have tested the following similar code (which would not do what I want but that's not the point here):
<$set name=y filter="[<proj>indexes[]addsuffix[/project]filter[match<ref>]]">
y(<<ref>>) = «<<y>>»
</$set>
the output is
y(2/project) = «0/project 1/project 2/project»
instead of
y(2/project) = «2/project»
So this is the very same thing which is happening.
--
Jean-Pierre