sort repeated grid

5 views
Skip to first unread message

Jarosław Kowalewski

unread,
Feb 18, 2020, 5:15:55 PM2/18/20
to orb...@googlegroups.com
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

Erik Bruchez

unread,
Feb 18, 2020, 5:56:09 PM2/18/20
to orb...@googlegroups.com
> 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/

Jarosław Kowalewski

unread,
Feb 18, 2020, 6:21:02 PM2/18/20
to orb...@googlegroups.com
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

--
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/1582066574663-0.post%40n4.nabble.com.

Erik Bruchez

unread,
Feb 18, 2020, 7:14:09 PM2/18/20
to orb...@googlegroups.com
> 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

Jarosław Kowalewski

unread,
Feb 18, 2020, 7:37:25 PM2/18/20
to orb...@googlegroups.com
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

--
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.

Erik Bruchez

unread,
Feb 19, 2020, 1:46:17 AM2/19/20
to orb...@googlegroups.com
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.

Jarosław Kowalewski

unread,
Feb 19, 2020, 3:25:45 PM2/19/20
to orb...@googlegroups.com
Thanks Erik for the explanation. 

//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 orbeon+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages