Sort dynamic dropdown

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Sort dynamic dropdown

mbojja
Hi Alex - Is it possible to sort the values alphabetically in a dynamic dropdown? 

Thanks
Manish

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/9f012881-ee9b-448f-b72d-c407787343c7%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Sort dynamic dropdown

Alessandro  Vernet
Administrator
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/

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571851401521-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Sort dynamic dropdown

mbojja
Works perfect! thanks Alex

On Thu, Oct 24, 2019 at 1:23 AM Alessandro Vernet <[hidden email]> wrote:
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/

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571851401521-0.post%40n4.nabble.com.

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/CAN39TsOiDabMRwT22WZGzb564JpkqA40Mg236m317NrmMGFcaQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Sort dynamic dropdown

Alessandro  Vernet
Administrator
Perfect Manish, and thank you for the confirmation.

‑Alex

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

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/orbeon/1571949500800-0.post%40n4.nabble.com.
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet