<% if [<set-img-list>is[variable] %>
<!-- always "true" -->
<!-- no error reported anywhere I can find -->
<% endif %>
@jeremyruston Worth a bug report?
<% if [<set-img-list>is[variable] %>
<!-- always "true" -->
<!-- no error reported anywhere I can find -->
<% endif %>
@jeremyruston Worth a bug report?
Hi @CodaCoder the code above is equivalent to this:
<$list filter="[<set-img-list>is[variable]">
<!-- always "true" -->
<!-- no error reported anywhere I can find -->
</$list>
Thereās clearly a syntax error in the filter expression, but if you try that filter expression in the $:/AdvancedSearch āfilterā tab you will see the error Filter error: Missing [ in filter expression
.
The problem is that the error message is returned as the result of the filter expression. That means that the <%if%>
statement will always see the expression as returning a result, and thus classify it as ātrueā.
The deeper problem is that there isnāt another obvious way to report syntax errors in filters.
List last N filter errors in (new) More-tab tab?
Crazy brain-fart?
@CodaCoder a reasonable workaround when trying to debug the āIf codeā, is to display the filters result with the condition variable.
<% if [<set-img-list>is[variable] %>
<!-- always "true" --> <<condition>>
<!-- no error reported anywhere I can find -->
<% endif %>
Filter error: Missing [ in filter expression
In this example I changed each filter to test the different places
<% if [[a]match[b]] %>
Loaded from a file URI #1 <<condition>>
<% elseif [[b]match[c]] %>
Loaded from an HTTPS URI #2 <<condition>>
<% elseif [[c]match[d]] %>
Loaded from an HTTP URI #3 <<condition>>
<% else %>
Loaded from an unknown protocol #4 <<condition>>
<% endif %>
<<condition>>
value. that is the else.Another trick I have being using in functions in the if and elseif filters, it is then possible to just use the variable to see its result.
\function my.filter() [[true]!match[true]
!!<<my. Filter>>
<% if [my.filter[]] %>
<!-- always "true" --> here
<!-- no error reported anywhere I can find -->
<% endif %>
If you think about it this problem occurs in a number of places where you donāt get to see the filters result.
[Post script]
You could even test for the error condtion
\function my.filter() [[true]!match[true]
!!<<my.filter>>
<% if [my.filter[]prefix[Filter error:]] %>
<!-- always "true" --> Error condition ''<<condition>>''
<!-- no error reported anywhere I can find -->
<% endif %>
Bingo. Thanks. ā