Filter by Column : Filter Bar for all columns

Filter by Column is a script FAYT command for Directory Opus, who makes it easy to quickly filter the current file display, based on almost any column content.

Main features are:

  • Filtering by almost all built-in Directory Opus columns.
  • Filtering by Script, Evaluator and Shell columns.
  • Search Mode, that allows you to perform an advanced recursive search with the same parameters instead of filtering.
  • Define custom names to refer to a specific column.
  • Filtering/Searching by columns even if they are not used (visible) in the current file display.
  • Support for the following flags: ignore diacritics, case-sensitive, whole words and regular expressions.
  • Support for filtering items in expanded folder.
  • Specialized syntax according to the column data type (date, number, size, duration and text). For example, referring to the "Size" column, the command understand input as >2mb or <= 100kb.
  • Filtering can be performed on any column, either referring explicitly to the column number position, the custom name given to an specific column, or implicitly by "Name" column, current sorting column or any user-defined column.
  • Option to define the data type for Script, Evaluator and Shell columns.
  • Quick flags configuration from the same command.
  • Support for command input history.

How to Install

Download the file below. Then double click the file or run Prefs SCRIPTINSTALL and select the downloaded file.
:warning: IMPORTANT: Needs at least v13.2

v1.3.2 : ColSearch.opusscriptinstall (18.1 KB)

Configuration

First open Preferences. Then navigate to Filtering and Sorting / Quick Keys (or use Prefs PAGE=quickkeys) and change the assigned quick key. Change the hotkey to the one of your choice. By default it is set to $.

Script Flags

In that same section, you can change some options too. Open the Filter by Column menu and check/uncheck according to your needs.

  • Ignore non qualified items: Certain files may not have data in some columns. For example, a jpg file cannot have data in the "Duration" column. By enabling this option, when a filter operation is performed, the type of metadata a file may have is taken into account for their inclusion in the results.
  • Search Mode: Allows to perform an advanced search using the same parameters.
  • Case sensitive, Regular Expressions, Ignore diacritics and Whole words: Self explained.

Script Configuration

There are also other configurations to consider. In the Script Management window (Settings / Scripts). Select Filter by Column and click in the gear icon.

  • custom_columns_names: Here you can define custom names to refer to a specific column, using the following syntax:
    "mycolname":"<col name>" (quotes are mandatory)
    Where <col name> is the actual column internal name. (Press the configured quick key twice to show a list of current column's names).
    Don't use any operator (<,=,> or !) for mycolname value.
    image

  • default_implicit_column: If a column is not explicitly specified, choose between filter by name, current sorted column or user_defined_implicit_column value.

  • labels_access: Choose whether the filtering by labels should include all or only those visible in the Label Column.

  • use_filters_for_builtin: If true, use textual filters for filtering built-in columns. In that case, some options may not apply.

  • user_defined_implicit_column: In implicit mode, filter by this column, if it exists. If not, the Name column will be used.

  • flags_quickkey: This option allows you to set the same flags without going all the way through Preferences > Filtering and Sorting > Quick Keys, simply by typing in the FAYT bar the character configured in this option. By default is set to ?.

  • max_history_size: Maximum number of entries to be remembered.

  • debug: Logging level to be displayed. OFF to shows none. ALL to shows all the messages. WARNING to shows error conditions that are of consideration.

  • custom_columns_categories: Here you can define the type of data that a column returns. Used for Script, Evaluator and Shell columns.
    Format: "<name>":"<type>"
    <name> must be the same value as the column keyword. <type> can be string, date, duration, number or size.
    With the Script Log panel open, you can type the quick key twice successively to find out the name of all currently visible columns.

  • preferred_filter_mode: Choose the method to get the data from a Script, Evaluator or Shell column.

    • Textual Filters : Faster, no temporary files.
    • Rename Preset : Slower, with temporary files. Deprecated, mostly keep it as a legacy, for eventual issues when using Evaluator.
  • add column: Add the referenced column to the results tab after the search.

  • collection name: Collection name for the search results.

  • create subcollections: Create sub-collections instead of overwriting search results.

Usage

Filter by Column can be used in two modes : Filter Mode and Search Mode.

  • FILTER MODE is the default mode, and acts similar to the regular Filter Bar, but with many more options, makes it easy to quickly filter the current file display by any property, even if its column is not visible (if not referenced by its position).

  • SEARCH MODE lets you perform an advanced search, using the same search parameters than the filter, but recursively, in the current source path. The results will come in a collection in a new tab in destination.

To enable it, you can either check the flag Search Mode (this will make the default mode), or invoking by double typing your configured quick key for the command (e.g. $ $)
Note that this acts as a toggle, that is, one $ to invoke the default mode, and two $ $ to invoke the other, depending on the value of Search Mode flag.

Syntax

Columns can be referenced in two ways : implicitly or explicitly.

Explicitly: By using the following syntax:

  • C[number][operator][query]
    [number] refers to the position that the column occupies in the current file display, starting from 1. If the first column is the Index(#) column, it is omitted from calculation.
    e.g. C2=tag1

  • [mycolname][operator][query]
    [mycolname] refers to the custom name given by the user in custom_columns_names in Script configuration.
    e.g. mycustomcoldate=today

Implicitly:
If none of the above syntaxes are used, it means that the column to be filtered is implicitly referenced.

  • The column used will be choosed based on the default_implicit_column value.
  • In this mode, the '=' operator is implied (when used as a equal/not equal comparison).
    e.g. txt ; !Dop ; > 30 mb

Operators:

Valid [operator] are =; !=; <; <=; > and >=. When the column is of type 'string', the valid operators are = and !=. For all other types, all operators apply.

Query:
[query] has specialized syntax according to the column data type:

Date :

  • today, tomorrow, yesterday (yday), thisweek(week), lastweek(lweek), thismonth (month),lastmonth(lmonth),thisyear(year),lastyear(lyear)
  • Text in the format yyyy, MM (to refer to a month of this year) or MM-yyyy
  • [day]d Filter only by day value shown, regardless of the other values
    e.g. C2=12d will match both 12-12-2023 and 12-03-2021 values
  • [month]m Filter only by month value shown, regardless of the other values
    e.g. C2=11m will match both 12-11-2023 and 12-11-2021 values
  • [x]ha|da|ma|ya Filter for [x] hours|days|months|years ago from current date.
    e.g. C2>=11da will match all values 11 days old from current date.
  • Times can now be taken into account when comparing, if the input contains them.
  • HH:mm or HH:mm:ss Filter only using the time value
  • Date in format dd-MM-yyyy HH:mm:ss or yyyy-MM-dd HH:mm:ss (also without the seconds)
  • Text in date format supported by Date Object
    e.g. C2 > 2023/12/12
  • The following syntax, when using with = or != operator, have support for ranges (using .. as separator between both limits):
    • [day]-[day]d
    • [month]..[month]m
    • yyyy..yyyy
    • MM/yyyy..MM/yyyy
    • dd-MM-yyyy..dd-MM-yyyy or yyyy-MM-dd..yyyy-MM-dd
    • dd-MM-yyyy..dd-MM-yyyy HH:mm:ss or yyyy-MM-dd..yyyy-MM-dd HH:mm:ss (also without the seconds)

e.g. 10-12d; 2000..2023; 7/2021..11/2023; 8-1-2024 1:34..23-1-2024 2:19

Size :

  • [number] kb|mb|gb|tb|pb
    e.g. C3>4mb ; C2<=100 kb
  • In conjunction with = or != operators, you can use notation for ranges using .. or - between both limits (inclusive)
    e.g. C3=2mb..3.5mb

Number:

  • In conjunction with = or != operators, you can use notation for ranges using .. or - between both limits (inclusive)
    e.g. C2=4-7

Duration :

  • HH:mm:ss , mm:ss or any integer referring to total seconds
    e.g. C5=1:10:00 ; c5 > 20
  • In conjunction with = or != operators, you can use notation for ranges using .. or - between both limits (inclusive)
    e.g. C2=4-7 (meaning seconds) ; c2=1:10:00..2:20:00

Finally, as a bonus, when you filter by Name column, you can refer to any of your file type groups registered, using [grp]:[query], where:

  • [grp] use (kind of) fuzzy match for all your registered file type groups. e.g. img will match Image file type group. Note that for matching, it will use the displayed (translated) name for that group.
  • [query] It's used to filter for all files whose name match with query and belong to the specified file type group.

e.g. img:abc will match all files whose name contains abc and belong to filetype group Images.
doc: will match all files who belong to file type group Documents.

FAQ

For simplicity, let's assume that the assigned quick key for this command is $, and that the filter is not the default one.
If you've changed the assigned quick key to another one, replace any occurrence of $ in the directions above with your new assigned key.
If you set this filter as default, usually is not longer needed to type $, unless you want to use another characters who is currently in use as a quick key for another filter. For using the non default mode, $$ is always required.

How to get a column name

E.g. User Description column

  • First, add the column to your current file display.
  • Now type in the FAYT bar: $$ and press Return.
  • The Script Log will open if not visible. In there you can see a list of all visible columns. Copy the value after "Name : " from the target column.
  • You can easy recognize the target column by its header value.

How to register a custom name

  • First you need to know the name for the column you want to use. (How to get a column name).
  • Now go to the Script Management window (Settings / Scripts). Select Filter by Column and click in the Edit button.
  • In the new open window, double click in custom_column_names. Then in that window add the following at the end, in a new line: "custom name":"column name"
    custom name is the name you want to use to refer that column from now on. Change to your like. Remember this value is case sensitive, so custom name is different than Custom Name.
    column name is the column's internal name you just copied.
    Remember that the syntax must include the quotes and the colon in between.
    e.g. "desc":"userdesc"

image

  • Click OK button in all opened windows to save your new values.

How to register a custom category

Custom categories are used for Script, Evaluator and Shell columns only, in order to let this command know what type of data a given column handles.
Usually, Evaluator columns don't need to be registered, as the command automatically reads that data from the column data, but you can register a category if you want to replace that value with another one.
Any unregistered column is considered by default as text (string).
To register a category :

  • First you need to know the name for the column you want to use. (How to get a column name).
  • Now go to the Script Management window (Settings / Scripts). Select Filter by Column and click in the Edit button.
  • In the new open window, double click in custom_column_categories. Then in that window add the following at the end, in a new line: "column name":"category"
    "column name" is the column's internal name you want to register.
    "category" valid values are string, number, date, duration or size.
    Remember that the syntax must include the quotes and the colon in between.
    e.g. "scp:col_search_test/tam":"size"

image

  • Click in OK in all opened windows to save your new values.

How to configure flags

Current available flags are described here.
You can configure this in Preferences / Filtering and Sorting / Quick Keys:

or by typing in the FAYT bar $+? and pressing Return.

image

How to change between Filter and Search modes

$ acts as a toggle for Filter Mode and Search Mode.
$ to use the default mode
$$ to use the non-default mode.

By default Filter Mode is the default. Search Mode will be the default mode if you enable Search Mode flag.

Examples

Context : Filter Mode is set as the default mode.

Example 1

Filter all items in the current file display whose User Description column value contain "Grumpy Cat". I want to create a custom name for that, so I can use mydesc=Grumpy Cat.

Procedure

  • In order to refer a column by its name. first we need to check if it's registered under custom_columns_names in Script Configuration.
  • If it's not there, we need to first know its internal name. (How to get a column name), which is userdesc.
  • If is not already registered, we do it using "mydesc":"userdesc"(How to register a custom name).
  • 'User description' is a built-in column, so no need to register a custom category.
  • Since we want to find "Grumpy Cat", but no "grumpy cat", check in flags Case sensitive.
  • Type $mydesc=Grumpy Cat

Example 2

Filter all items in the current file display whose 'User description' column value matches exactly "Grumpy Cat".

Procedure

  • Perform the same steps as the previous case regarding the prior registration.
  • Check in flags Case sensitive and Regular Expressions.
  • Type $mydesc=^Grumpy Cat$

Example 3

Search for all items in the current source folder and its subfolders whose custom script column named My Date has a value of 3 months ago or later, from the current date.
I want to refer to this column as mydate.
Procedure

  • In order to refer a column by its name. first we need to check if it's registered under custom_columns_names in Script Configuration.
  • If it's not there, we need to first know its internal name. (How to get a column name), which is scp:mycoldate/mycoldate.
  • If is not already registered, we do it using "mydate":"scp:mycoldate/mycoldate". (How to register a custom name).
  • My Date is a script column that I want to be recognized as date, so I need to register it (if it's not already) in custom categories using "scp:mycoldate/mycoldate":"date". (How to register a custom category)
  • Type $$mydate>=3ma

Example 4

Search for all items in the current source folder and its subfolders whose custom script column named My Date has a value not included in the interval between Feb 2,2001 09:54 and Dic 3, 2004 19:55. I want to refer to this column as mydate.

Procedure

  • Perform the same steps as the previous case regarding the prior registration.
  • Type $$mydate!=2-2-2001 09:54..3-12-2004 19:55

Example 5

I want to use the value from the 'Tags' column whenever filtering/searching implicitly. For example, to filter to filter all the items in the current file display that contain 'cat' in its tags

Procedure

  • We need to know the internal name used for Tags column. which is keywords (How to get a column name).
  • In Script Configuration, change default_implicit_column to user_defined_implicit_column and set user_defined_implicit_column to keywords.
  • Type $cat
  • You may want to check other flags, like Whole words to only match complete tags.

Notes

  • Columns showing time data only, are treated as of "duration" type.
  • The command implements two ways to get values from a Script column: via Textual Filters and through the abuse of Rename Presets. preferred_filter_mode allows to choose the method to use. Each method has its pros and cons.
    • Filters :
      • It is faster, no temporary files are created or used.
      • No support for results inside expanded folders.
    • Rename Preset :
      • It is slower, some wizardry and temporary files are used.
      • Support for results inside expanded folders.
  • If you choose to use Textual Filters Mode for built-in columns, please note still has some limitations:
    • Can't get results inside expanded folders.
    • Ignore non qualified items flag is not applicable.
      To enable it, set the use_filters_for_builtin option in Settings to true.
  • To display the results inside expanded folders, it is necessary to also display the ancestors of the item, even if they do not match the filter.
  • The command is not enabled on sites perceived as 'Shell' type (e.g. This PC) or on MTP or FTP or PLUGIN.
  • Unsupported columns are as follows:
Unsupported columns
	'group':
	'md5sum':
	'shasum':
	'blake3sum':
	'crc32sum':
	'sha256sum':
	'sha512sum':
	'thumbnail':
	'status':
	'sizerel':
	'disksizeauto':
	'disksize':
	'disksizekb':
	'disksizerel':
	'uncompressedsize':
	'dircount':
	'dircounttotal':
	'filecount':
	'filecounttotal':

Know Issues

  • None

Changelog

v1.3.2 (Feb 24, 2024) :

  • Now, the column doesn't need to be visible when filtering/searching and not using a position-based column reference(e.g. C1, etc.)(there's no longer Filter even if no visible flag).

v1.3.1 (Feb 22, 2024) :

  • Introducing 'Search Mode' flag, to perform a recursive search in the current source folder, using the same filter and parameters.
  • Enabled filtering by filetype group when using Search Mode.
  • $ $ (or your configured quick key) works as a toggle between filtering and searching.
  • Search Mode has several options for configuration (collection name, use subcollections, add column).
  • Added range search for dates with the format:
    • dd-MM-yyyy or yyyy-MM-dd
    • dd-MM-yyyy HH:mm or yyyy-MM-dd HH:mm
    • dd-MM-yyyy HH:mm:ss or yyyy-MM-dd HH:mm:ss
  • Improved logic when searching by date ranges.
  • Improved parsing of custom categories and custom names.
  • Improved dialog for configuring flags. Now keyboard accelerators can be used. (also no more minimized listers).
  • Improved suggestions when typing. Now all the custom names are included as suggestions, accesible for both Filter and Search Mode.
  • Now custom names are case sensitive.
  • Evaluator columns doesn't need to declare their type (date, number, etc), since is readed from the very column file. You can still declare it though, if you want to override it (eg. declare as duration type a text Evaluator column).
Full changelog

v1.2.1 :

  • Now is possible to define custom names to refer an specific column when in explicit mode, using custom_columns_names in Script configuration.
  • Added a new flag: Use column even if it's not visible; allows to filter based on a column previously declared in custom_columns_names or in user_defined_implicit_column, even if it is not visible in the current file display.
  • Added labels_access in Script configuration, which allows to choose if the filtering by labels should include all or only those visible in the Label Column. (Please note that use_filters_for_builtin set to true, override this option).
  • Minor corrections.

v1.1.0 :

  • Textual Filters mode renewed, now it has no technical limitations and can be used to filter any relevant column.
    • Rename Presets mode is kept for the time being, for legacy and comparative reasons, it can be changed by using the preferred_filter_mode option in Settings.
    • This brings a substantial time improvement when filtering Script, Evaluator and Shell columns.
  • Option to filter built-in columns in Textual Filters Mode.
    However, please note still has some very small limitations:
    • Can't get results inside expanded folders.
    • Ignore non qualified items flag is not applicable.
      To enable it, set the use_filters_for_builtin option in Settings to true.

v1.0.6 (2024-01-23)

  • Added support for 'Permissions' and 'Availability' columns.
  • Minor changes in script configuration dialog.
  • Fixed filter by group not working in some scenarios.
  • Minor corrections.

v1.0.5 (2024-01-10)

  • Added support for 'accessedtime', 'createdtime', 'modifiedtime', 'encodedby', 'mp3drm', 'aspectratiogroup', 'picphyssize', 'initialkey' and 'target' columns.
  • Added user_defined_implicit_column in Script Configuration, to init implicit mode on a specific column.

v1.0.4 (2024-01-08)

  • Added filter by filetype group option when referring to "Name" column.
  • Added 'desc' column support.
  • Fixed 'userdesc' column not working properly.

v1.0.3 (2023-12-27)

  • [day]d; [month]m; yyyy; MM/yyyy and duration column types now support ranges (when used with = or !=).
  • Filters completely redesigned, now supports most cases and hopefully should return the same results as using Rename Presets.
  • Fixed a possible error if trying to use an incomplete|incorrect regular expression.
  • Added support for Zip type folders (when opening a zip file as a folder).
  • Various bugs fixed.

v1.0.2 (2023-12-26)

  • Added basic support for command input history (appears as a list of suggestions when typing in the FAYT field).
  • Corrected diacritics filtering not working in some scenarios.
  • New modes when filtering by date:
    • [day]d Filter only by day value shown, regardless of the other values (only built-in and via Rename).
    • [month]m Filter only by month value shown, regardless of the other values (only built-in and via Rename).
    • [x]ha|da|ma|ya Filter for [x] hours|days|months|years ago from now.
    • Times can now be taken into account when comparing, if the input contains them.
    • HH:mm or HH:mm:ss Filter only using the time value (only built-in and via Rename).
  • Added support for "TB" and "PB" for sizes.
  • Added support for ranges in columns of type 'number' and 'size'.
    • In conjunction with = or != operators, you can now use notation for ranges using ... or - between both limits (inclusive).
      e.g. 2mb..3.5mb, 4-7

v1.0.1 (2023-12-21)

  • Fixed an issue when filtering for values in Label Column.

v1.0.0 (2023-12-19) : Initial release

8 Likes

MEGA great! thank UUU!

v1.0.1 fixed an issue when searching for values in Label column.

2 Likes

Hello. can i find a needed month (or time) with the script?
when i type $/06/ i get an error:

22/12/23 6:32 Search by Column:  ERROR   => Search input can't be converted to date
 22/12/23 6:32 Search by Column:  ERROR   => Input is not valid

for time filter 16: do nothing without error

I'm sorry but both the script and I fails to understand this.
What are you trying to search for?
For date type columns, you can search by a month for the current year, just using 06. For a particular month and year, you can use 06-yyyy.
Keep it in mind that 'date' is not treated like text, so regular expressions,case match,etc don't apply.

sorry, i just use slash for dates, thus i have 12/06/23 and I'm trying to find the sixth month of every year
and 06 doesn't work, only 6 works...

Yes, my bad. I'll correct that for the next version.

Also, I'll consider add support for searching for a specific day/month value. Thanks for the idea.

For BuildListFromPreset, creating a preset file is not necessary. The rename script can be embedded by putting it after the Rename command. For example, here is a command GetColumnValue I made to retrieve the column value:

// @set can't set an empty variable
@set glob:result
// SCRIPTARG doesn't work
Rename PATTERN * TO "&COLUMN&"
@script:jscript
function OnGetNewName(getNewNameData)
{
    if (!DOpus.vars.Exists("result"))
        DOpus.vars.Set("result", getNewNameData.newname);
    else
        DOpus.vars.Set("result", DOpus.vars.Get("result") + '\n' + getNewNameData.newname);
    return true;  // prevent rename
}
// Access the result by `{$glob:result}`
// Delete the result by `@set glob:result`
1 Like

@Chaoses-Ib you need to use Evaluator to get the actual value and not something escaped to be path friendly. Using that in TO directly may not work in some scenarios. That's why a rename preset is needed.

v1.0.2 brings several improvements and new syntax. Check the whole changes in main post.

2 Likes

Thanks a lot. it would be nice for "between search" by month and dates. ex, 10-11m

v1.0.3 is up for testing! Probably the last one, we'll see.
Contains several additions and corrections, which can be read in the main post.

2 Likes

v1.0.4 comes with a very handy option for search by Name using file type groups. Also fix searchs in some columns not working and brings support for 'desc' column.

2 Likes

v1.0.5 comes with a very welcomed additions, such extend support for more columns, and the ability to define a column name in implicit mode. Read the main post to find out about the details.
Also, due to the new changes, you will probably need to reconfigure certain script options. Sorry about that. (you can use Prefs SCRIPTS=ColSearch.js* for quick access).

1 Like

v1.0.6 is up with support for 'Permissions' and 'Availability' columns. With that, all columns with meaningful values for filtering are supported now.

2 Likes

Since in the last few weeks I've discovered the use of Evaluator clauses in textual filters, this has opened the opportunity to expand the capabilities of this script when using it in that mode. Now it no longer has the previous limitations and in theory it could filter any relevant column, applying the search flags as well.
The v1.1.0b brings the following major improvements:

  • Textual Filters mode renewed, now it has no technical limitations and can be used to filter any relevant column.

    • Rename Presets mode is kept for the time being, for legacy and comparative reasons, it can be changed by using the preferred_filter_mode option in Settings.
    • This brings a substantial time improvement when filtering Script, Evaluator and Shell columns.
  • Option to filter built-in columns in Textual Filters Mode.
    However, please note still has some very small limitations:

    • Can't get results inside expanded folders.
    • Ignore non qualified items flag is not applicable.
      To enable it, set the use_filters_for_builtin option in Settings to true.

If you wish to test the new beta version, you can download it from the main post. Your feedback is highly appreciated!

3 Likes

Nice script @errante. I gave v1.1.0b a try with an evaluator column and it works perfectly after following your installation and configuration instructions. :grinning: :+1:

I understand that instead of specifying a column number, I could define my eval column as the user_defined_implicit_column to add a level of convenience. What would be even more convenient would be the ability to specify a column label using a suitable prefix to identify that a label follows. e.g.

$LMyColLabel!="" as an alternative to $C5!=""

Without digging deeply into your code I have no idea how hard it would be to implement what is only a "nice to have" suggestion.

Thanks! Glad you found it useful.
Note that some instructions are not longer required in the beta. e.g. (and I forgot to mention) for Evaluator columns, is not longer mandatory to define their type in custom_columns_categories.
The script will parse your configuration to see what type that column is declared. graph and percentage type are going to be disabled.
Only define the type if you want to override it. e.g. useful if you have a Evaluator column with a duration notation, but defined as text.

In my todo list. Thanks for the feedback!

Update v1.2.0 Beta (2024-2-2) :

  • Added the possibility to define custom names for columns in explicit mode.

For using this option, use the new entry in config named custom_columns_names.
Define custom names to refer for an specific column, using the following syntax:
"mycolname":"<col name>"
Where <col name> is the actual column raw name. (Press this command's quick key twice to show a list of currently visible column's names).
Don't use any operator (<,=,> or !) for mycolname value. You also probably shouldn't use long names with spaces in it.
You can refer any column you like. A visual example:
image

You were right @aussieboykie, this make it more useful!

PD: @Leo can you please change this post to Scripts category? Thanks.

Update v1.2.0 Beta 2 :

  • Added a new flag: Filter even if not visible; allows to filter based on a column previously declared in custom_columns_names, even if it is not visible in the current file display.
  • Added labels_access configuration option, which allows to choose if the filtering by labels should include all (including status) or only those visible in the Label Column. (Please note that use_filters_for_builtin set to true, override this option).
2 Likes