Hi,
I'm following this tutorial to create a custom sort operator for GQI.
The example is going over the table row by row to identify the relative sorting position.
However, in my use case, I need the full column dataset to determine the relative sorting position.
Is there a way for me to get all values from a given column in my custom operator?

Hi Thomas,
Thanks for your feedback.
However, from the provided documentation, I'm unable to figure out how I can get all values in one column in one go.
The GQIColumn class doesn't seem to contain a method or property to fetch the info.
Do you have an example?
I'm sorry, I have misread your question. I don't think it is possible to get the entire column.

Hi Ive,
Not sure if it would work for your application, but have you tried using the 'Column Manipulations' method 'RegExMatch', where you can create a new column in the GQI table based on the RegexMatch results of selected column, then sort off this new results column? It may take a couple column manipulations as Regex in GQI only acts off the first match, you cannot group them together.
Hi Ive,
With a custom operator it is currently not possible to access all column values at once. However, it should still be possible to apply any sort order.
The key is to find a mapping of for the cell values you want to sort to a related set a values that can then be sorted by default sort operator.
This mapping can be implemented using a custom operator, and can be linked to your original column for sorting by using the Sort Redirector operator from the catalog.
Example
Let's assume you have a column called "Numbers" with possible values "One", "Two", "Three", "Four" that when sorted should be in this numerical order.
By default, when sorting on this column the values would be sorted alphabetically: "Four", "One", "Three", "Two". We don't want this.
To change the sort order:
- Create a new custom operator "Calculate sort values" that does the following:
- Takes as input the column with the original values
- Adds a new integer column, let's call it "Sortable"
- For every row in the data set:
- Gets the original cell value from the row
- Maps the original value to its numeric value ("One" -> 1, "Two" -> 2 etc.)
- Stores the numerical value in the new "Sortable" column of this row
- Create the following query:
- Your original query
- Custom operator: "Calculate sort values"
- Argument: "Numbers" column
- Custom operator: Sort Redirector
- Redirect from column: "Numbers" column
- Redirect to column: "Sortable" column
- Select: all but the "Sortable" column to remove it from the end result
Now, whenever a Sort operation is performed on the "Numbers" column of this query, the rows will be sorted using the corresponding numerical values from the "Sortable" column.
Note
As of DataMiner 10.5.9, Custom Operators do not support real-time updates yet. If this is a requirement, the only viable solution is consolidate all the custom operator logic together with the rest of your query into a single ad hoc data source.
Hi Ive.
You can retrieve the entire column, through "header.GetColumn(columnName), in the HandleColumns method.
You can find more details about the HandleColumns method on the docs:
https://docs.dataminer.services/user-guide/Advanced_Modules/Dashboards_and_Low_Code_Apps/GQI/Extensions/Custom_Operator/Tutorials/Custom_Operator_Tutorial.html?q=HandleColumns
It receives a GQIEditableHeader as argument, which can access individual columns:
https://docs.dataminer.services/user-guide/Advanced_Modules/Dashboards_and_Low_Code_Apps/GQI/Extensions/API_Reference/GQIEditableHeader.html?q=GQIEditableHeader
There is also a full example on documentation about custom sorting:
https://docs.dataminer.services/user-guide/Advanced_Modules/Dashboards_and_Low_Code_Apps/GQI/Extensions/Custom_Operator/Tutorials/Redirect_Sort_Operator.html