.. highlightlang:: us .. index:: auto_SetFilter .. _auto_setfilter: auto_SetFilter ============== .. us.tag auto_SetFilter ENGLISH :ref:`auto_SetFilter` sets a filter to filter data records. .. function:: bool = auto_SetFilter(ssFilter) bool = auto_SetFilter(ssFilter, ssNCName) bool = auto_SetFilter(ssFilter, ncid) .. us.return **Return Value** *bool* .. us.params **Parameters** .. uparam:: ssFilter *ssFilter* is a scalar string that specifies the record filter. The filter can consist of up to seven AND (``&&``) or OR (``||``) connected comparisons. Each consists of a channelname enclosed in $ characters, followed by an operator, followed by a value. The operator must be enclosed in spaces. Channel names may contain the following special characters: ``.``, ``-``, ``+``, ``$``, ``#``, ``~``, ``!``, ``^``, ``&``, ``%``. The special characters must be replaced by underscores. See example. The following operators are available: .. list-table:: :header-rows: 1 * - Operator - Meaning * - Channelname < Value - True if Channelname is less than Value. * - Channelname <= Value - True if Channelname is less than or equal to Value. * - Channelname == Value - True if Channelname is equal to Value. For the equal operator a tolerance can be specified as an absolut value or in percent. The tolerance must be enclosed in round braces. See example. * - Channelname != Value - True if Channelname is not equal to Value. * - Channelname > Value - True if Channelname is greater than Value. * - Channelname >= Value - True if Channelname is greater or equal to Value. The channel must be a real or a string vector. For text channels the wildcards ``*`` and ``?`` can be used. The asterisk character (``*``) substitutes for zero or more characters. The question mark (``?``) substitutes for exactly one character. Example:: auto_SetFilter("$Mode$ == On*") Insert a space between each element. If the search text contains spaces the string must be enclosed in quotest with leading backslashes:: auto_SetFilter("$Mode$ == \"a b\"") An empty filter string disables the record filter. The NC file name must be specified:: auto_SetFilter("", "d:/test.nc2") .. uparam:: ssNCName *ssNCName* is the complete name of an NC-Data file. This parameter is optional, if the ``auto_ImportData()`` has been called before ``auto_SetFilter``. .. uparam:: ncid Identifies the netCDF file. .. us.example **Example** :: svFile = GetRootDirectory() + "samples/vollast.asc"; svFile[1] = auto_ImportData(svFile[1]); auto_SetFilter("$N$ > 1000 && $N$ < 5000 && $MEFF$ >= 100"); auto_ImportData(svFile[1]); auto_SetFilter("$N$ == 1000(0.5%)"); // Tolerance +- 0.5 % of 1000 auto_ImportData(svFile[1]); auto_SetFilter("$N$ == 1000(5)"); // Tolerance +-5 rpm .. us.history **History** .. list-table:: :header-rows: 1 * - Version - Description * - R2013.10 - Parameter ncid added. Error with string channels corrected. * - R2013.3 - Filer can contain string channels. .. seealso:: :ref:`overview-automation`, :ref:`auto_ImportData`, :ref:`dialog-box-data-filter` :sub:`id-1372812`