VIEW_SEARCH

[[VIEW_SEARCH:regexvar]]

regexvar(variable name) Name of the variable containing a regular expression string which must be true before row is selected into view.   Example regular expressions:

Washington|Oregon
Washington{OR}Oregon
Washington{AND}Oregon    
(Washington)(Oregon)
((Washington|Oregon)(red|blue))

The first and second expressions select every row with any variable content matching Washington or Oregon.

The third and fourth expressions select every row with any variable content matching both Washington and Oregon.

The fifth expression selects every row with any variable content  matching the states Washington or Oregon which also matches red or blue.

Note that the {OR} and {AND} are TerraDctl extended Regex operators which will not work in ordinary PHP code. All standard perl comparable regular expression syntax is allowed. For more on regex please visit PCRE at php.net.

This example filters the current view by using the regular expression (regex) selection criteria ‘Wa|Or’.

[[LOAD_DATAFEED:csv_datafeed.txt|,]]
[[VIEW_DATAFEED]]
[[cr]][[cr]]Before selection:[[cr]][[cr]]
[[VIEW_DISPLAY]]
[[INITIALIZE:search|'Wa|Or']]
[[VIEW_SEARCH:search]]
[[cr]][[cr]]After Selection:[[cr]][[cr]]
[[VIEW_DISPLAY]]

Result:

Before selection:

 Name: Washington
Id: 1
Color: blue
Size: big

Name: Oregon
Id: 2
Color: "green"
Size: small

Name: California
Id: 3
Color: red
Size: huge

After Selection:

 Name: Washington
Id: 1
Color: blue
Size: big

Name: Oregon
Id: 2
Color: "green"
Size: small

Leave a Reply