DS-Sorting non-numerical fields
This is an open discussion with 3 replies, filed under General.
Search
A ~~reference field~~ might do the trick … will investigate. Any other insights are highly welcome! :)
Maybe you could use Reflection field to process a numeric value from this strings and than sort your entries based on this reflection.
Or maybe it would be meaningful to break these values into multiple fields, lets say also with reflection fields, if you need to keep this syntax (don't know the meaning of that value), and filter it in some way there.
Well, if the "reference field" you mention is not already the reflection field :) I don't know all of the fields ..
Thanks Juraj, indeed I meant to write Reflection field
.
I ended up using the Reflection field
with the following stylesheet:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" extension-element-prefixes="dyn exslt" xmlns:exslt="http://exslt.org/common" xmlns:dyn="http://exslt.org/dynamic" xmlns:str="http://exslt.org/strings" > <xsl:template match="data/entry"> <data> <xsl:element name="sig-sort"> <xsl:value-of select="format-number(sammlung/item/@id, '000000')"/> <xsl:text>-</xsl:text> <xsl:for-each select="str:tokenize(sig/@handle, '-_qwertzuiopasdfghjklyxcvbnm')"> <xsl:value-of select="format-number(., '000000')"/> <xsl:if test="position()!=last()"><xsl:text>-</xsl:text></xsl:if> </xsl:for-each> </xsl:element> </data> </xsl:template> </xsl:stylesheet>
This turns an example entry like:
NL Mellin 1-1 07
into:
000005-000001-000001-000007
The first number sammlung/item/@id
is used to group all items that belong to a certain collection. The rest is the retrieved numerical values in the string with plenty of leading zeroes for proper sort order. This will however omit any letters in the string for sorting.
Create an account or sign in to comment.
I have a
datasource
that currently sorts via aninput-field
the following way:How can I force the
DS
into sorting more sensible? Like this:Is there any
convert-to-number
-function I can use in the DS-Editor?