Sort dynamic dropdown

19 views
Skip to first unread message

MANISH

unread,
Oct 23, 2019, 3:13:46 AM10/23/19
to Orbeon Forms
Hi Alex - Is it possible to sort the values alphabetically in a dynamic dropdown? 

Thanks
Manish

Alessandro Vernet

unread,
Oct 23, 2019, 1:23:23 PM10/23/19
to orb...@googlegroups.com
Hi Manish,

You can use the `xxf:sort()` function for this (see link below for more on
that function). For instance to sort the list of countries in reverse
alphabetical order, you would do:

xxf:sort(/countries/country, name, 'text', 'descending')

And replace `descending` by `ascending` to get the normal alphabetical
order. (I'm just doing the reverse here, as the service I've used already
returns a list sorted in alphabetical order, so you wouldn't see the
difference.) In the Form Builder Control Settings dialog you'd have
something like: dynamic-dropdown-xxf-sort.png
<http://discuss.orbeon.com/file/t119778/dynamic-dropdown-xxf-sort.png> .
You'll let me know if this works for you!

https://doc.orbeon.com/xforms/xpath/extension-functions/extension-xml#xxf-sort

‑Alex

-----
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
--
Sent from: http://discuss.orbeon.com/

MANISH B

unread,
Oct 23, 2019, 9:32:14 PM10/23/19
to orb...@googlegroups.com
Works perfect! thanks Alex

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orbeon+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571851401521-0.post%40n4.nabble.com.

Alessandro Vernet

unread,
Oct 24, 2019, 4:38:23 PM10/24/19
to orb...@googlegroups.com
Perfect Manish, and thank you for the confirmation.
Reply all
Reply to author
Forward
0 new messages