Hi Dojo,
I have a Table component on my Low Code app, which displays IP information.
When we try the sort the Column with the IP information, the sorting is currently done as a 'string'. As can be seen on the image below.
Would there be any way we can get this to sort as an 'IP Address'? This would greatly improve the user experience when looking through the information.
Thanks for the help!
As Toon already mentioned, there is currently no way yet to get a custom sort order for columns; they all use the default comparison for their column type.
A possible solution is to use a custom operator in the following way:
- Remove the original 'Network address' string column
- Add a new 'Sortable network address' column of type integer
- Fill in the cells of the new column as such:
- Value = the IP address ranking
- DisplayValue = the original IP address string
This ensures that the user only sees the IP string and never the underlying integer ranking.
It also still allows the user to sort dynamically by clicking the column header.
The script could look something like this:
There is no such thing as "natural sorting" (aka finding the multiple digit numbers in pieces of text and combining them into one for sorting purposes) in low code apps and dashboards right now. You will also notice this when using numbers in your folder structure in dashboards for instance.
You could use a custom operator for your GQI query to implement this in your use case though (still in soft-launch).
We could add a custom operator that converts an IP address to decimal and sort on the decimal value.
But ideally the decimal would be hidden because it’s meaningless. It is only useful for sorting.
Do you know if it is possible to sort a table based in a hidden column?
Hi Toon – how would you handle a case like this with a custom operator? Because I believe that expectation here is that if the user clicks on the column header to sort the data, that it would use a specific logic to do that. I understand that you would be able to implement that logic with a custom operator, but the outcome of that, e.g. a ranking, would have to be outputted in a new column and the user would have then to rank on that column to get the desired sequence. But that doesn’t seem to me like what is desired here, and it would be not really intuitive for users. Or am I missing something here on how custom operators can be used?
No, Ben, you are correct. The best solution is to implement natural sorting everywhere in the front end code. But given that we don’t have that possibility right now, I indeed offered a solution that only works for server side sorting.
Bruno, that is another possible solution indeed. Given that GQI is conversational, you can first select the hidden column, then sort on it, and then do another select to get rid of it again. This should leave you with a correctly sorted table initially. However, like Ben says, the expectation here is probably to be able to do client side sorting on the fly. I don’t think that this is currently possible.
I’ve added an item on our backlog to investigate how easy it would be to support natural sorting in GQI (DCP208789). As GQI is an abstraction layer on top of all data sources, it will actually depend on the sorting capabilities of the underlying data sources. If the data sources do not support it, we would need to sort everything in GQI, which is something we don’t want to do for larger data sets.
Brilliant solution Ronald! Do note that this has some smaller implications (such as it will now be treated as an integer column in all operators, the feeding capabilities will be different, etc.).