I'm trying MapServer's run-time substitution to dynamically set my Mapfile's CLASS EXPRESSION values.
The expressions take the form of:
CLASS
EXPRESSION (([my_attr_col] >= num_1) && ([my_attr_col] < num_2))
...
END
When manually setting the expression values (not using run-time substitution) it works. (And only seems to do so when I use no quotes at all.)
When trying to pass the expression in dynamically with run-time substitution, then I add a VALIDATION block:
VALIDATION
'my_attr' '^[\s\S]*$'
END
and I modify the CLASS EXPRESSIONs along these lines:
CLASS
EXPRESSION '%my_attr%'
...
END
and I then append and send the information via the query URL.
However, I get this error:
msEvalExpression(): General error message. Cannot evaluate expression, no item index defined.
I've tried many permutations of quotes and regex filtering but I can't seem to figure out what would be accepted by MapServer.
http://url_address/cgi-bin/mapserv.fcgi?my_attr=((%5Bmy_attr_col%5D%20%3E=%20num_1)%20&&%20(%5Bmy_attr_col%5D%20%3C%20num_2))&etc...
EXPRESSION ([my_attr_col] >%test%)
and then having&test=1
in the request. When you get it to work you know that the variable gets transferred into EXPRESSION and the rest is making odd characters to pass the GET request, URL-encoding, and validation.