sort repeated grid

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

sort repeated grid

Jarosław Kowalewski
Hi,
is it possible in any way to sort out iterations in a repeated grid? 

e.g. row has two fields: date and hour. 
Each of them select's what generates a list like:
2020-02-01 11:00
2020-02-01 10:00  
2020-02-05 09:00
2020-02-05 08:00  
2020-02-01 06:00   

I need to have this list sorted for key: date, time. 

The solutions I can imagine:
1. exists native support for sorting
2. using xslt in the background and after each update of the repeat (value chagned or/and insert)
3. any other option? 

//Jarek

--
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/CAHFpwcVaT199-P-K8VDqz9mjvNg6wWfO48%3DXQ7DhW7hwgN-OYw%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Erik Bruchez
Administrator
> 1. exists native support for sorting

None, sorry.

I entered RFE #4434:

    https://github.com/orbeon/orbeon-forms/issues/4434

> 2. using xslt in the background and after each update of the repeat (value
> chagned or/and insert)
> 3. any other option?

You could do the sorting in XForms instead of XSLT, using custom model
logic:

    https://doc.orbeon.com/form-runner/advanced/custom

But it is tricky to do right, and since this work on the form's internal
data format, it might break with future Orbeon Forms updates. So really
ideally there should be a native way to sort a grid, or a built-in action to
do so.

-Erik

--
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/1582066574663-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Jarosław Kowalewski
Erik,
I'm not sure what you mean by "custom model logic" in xforms. Where do I need to put any sorting code? The simple example is still very simple, maybe too simple ;) 
As an example for sorting, I found: https://en.wikibooks.org/wiki/XForms/Sorting_using_XSLT
I can imagine to run xslt via saxon.
Please, provide any additional info.

//Jarek

wt., 18 lut 2020 o 23:56 Erik Bruchez <[hidden email]> napisał(a):
> 1. exists native support for sorting

None, sorry.

I entered RFE #4434:

    https://github.com/orbeon/orbeon-forms/issues/4434

> 2. using xslt in the background and after each update of the repeat (value
> chagned or/and insert)
> 3. any other option?

You could do the sorting in XForms instead of XSLT, using custom model
logic:

    https://doc.orbeon.com/form-runner/advanced/custom

But it is tricky to do right, and since this work on the form's internal
data format, it might break with future Orbeon Forms updates. So really
ideally there should be a native way to sort a grid, or a built-in action to
do so.

-Erik

--
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/1582066574663-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/CAHFpwcXKPXgGiDNzegbFOgG3gFxYawRs8JPznpWRAUpMcqsEXQ%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Erik Bruchez
Administrator
> I'm not sure what you mean by "custom model logic" in xforms.

Well, see the link I posted:

    https://doc.orbeon.com/form-runner/advanced/custom

-Erik

--
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/1582071247808-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Jarosław Kowalewski
Erik,
I saw the doc, but maybe for you, it's obvious. 
On that page you explain how to:
- load external resource
- add custom buttons

On that page there are only a few lines about the custom model is https://doc.orbeon.com/form-runner/advanced/custom#example-of-custom-model-logic 
Maybe for you, it's obvious but for me not.  I can imagine what I have to do in pure XForms to achieve my goals but the doc is not obvious (of course it can be related to my lack of knowledge).
I know how to import custom dialog and in the same way, I can import any custom model but what should I do/code in the custom model? Pure XForms doesn't support any sorting option.
//Jarek

śr., 19 lut 2020 o 01:14 Erik Bruchez <[hidden email]> napisał(a):
> I'm not sure what you mean by "custom model logic" in xforms.

Well, see the link I posted:

    https://doc.orbeon.com/form-runner/advanced/custom

-Erik

--
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/1582071247808-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/CAHFpwcXs1BFy%3D7umMpB9DRZgaoQ%3D51DJqy-4WztyLo1%2BsY59RA%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Erik Bruchez
Administrator
I thought you were specifically asking where to put the code. My answer was
about that part.

This said, I probably shouldn't have pointed to the custom model
documentation, because any code written this way will be brittle and very
hard to maintain. I think that unfortunately, at this point, the answer is
simply that you can't sort items in a repeated grid.

-Erik

--
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/1582094777977-0.post%40n4.nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: sort repeated grid

Jarosław Kowalewski
Thanks Erik for the explanation. 

//Jarek


śr., 19 lut 2020 o 07:46 Erik Bruchez <[hidden email]> napisał(a):
I thought you were specifically asking where to put the code. My answer was
about that part.

This said, I probably shouldn't have pointed to the custom model
documentation, because any code written this way will be brittle and very
hard to maintain. I think that unfortunately, at this point, the answer is
simply that you can't sort items in a repeated grid.

-Erik

--
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/1582094777977-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/CAHFpwcUa9gwH4yHJJfn8wh80Degm3tL6kBc-qHzx9PMLnLZDaQ%40mail.gmail.com.