How to dynamically bind two repeatable sections?

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

How to dynamically bind two repeatable sections?

ptrsbck
Hello,

I have the following problem:

On the form, I want to have two repeatable grids and copy values from one repeatable grid to another in proper positions. I've tried XPath expressions without results (xpath for number of repeatitions for grid2 equal to number of repeatitions of grid1, and one for copying values from those rows).

Let's picture it like that:

Grid1:
   Row1:
      Control1 - Value1
      Control2 - Value2
      Control3 - Value3
   Row2:
      Control1 - Value1
      Control2 - Value2
      Control3 - Value3

Grid2:  (number of rows equal to number of rows in Grid1)
   Row1:
      Control1 - Initial value comming from Grid1 - Row1 - Value 1
      Control4 - Value4
   Row2:
      Control1 - Initial value comming from Grid1 - Row2 - Value 1
      Control4 - Value4

 
Is there any way to achive that?


Regards and thanks in advance,
Piotr Sobecki

--
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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically bind two repeatable sections?

Alessandro  Vernet
Administrator
Hi Piotr,

The problem you describe is underspecified ;). Can users add/remove rows in
grid1? If they can, what happens to rows in grid2 when they do so? Also, can
they, in grid1, modify values in the first control of each row? If so, what
happens to the corresponding first control in each row of grid2?

In my experience, those scenarios often lead to unexpected behaviors, and it
is better to change the UI to avoid value being duplicated to a place where
they can be changed (but it is of course possible that your case is
different).

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically bind two repeatable sections?

ptrsbck
Yes, I agree that this is a poor design decision but unfortunately it's a client requirement.

Users can add/remove rows in grid1 and then amount of rows in grid2 should be modified accordingly (added/removed) to match number of rows in grid1.



W dniu wtorek, 20 lutego 2018 07:20:03 UTC+1 użytkownik Alessandro Vernet napisał:

> Hi Piotr,
>
> The problem you describe is underspecified ;). Can users add/remove rows in
> grid1? If they can, what happens to rows in grid2 when they do so? Also, can
> they, in grid1, modify values in the first control of each row? If so, what
> happens to the corresponding first control in each row of grid2?
>
> In my experience, those scenarios often lead to unexpected behaviors, and it
> is better to change the UI to avoid value being duplicated to a place where
> they can be changed (but it is of course possible that your case is
> different).
>
> 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 post to this group, send email to [hidden email].
Reply | Threaded
Open this post in threaded view
|

Re: How to dynamically bind two repeatable sections?

Alessandro  Vernet
Administrator
Hi Piotr,

Got it, then I would recommend you use a custom model (see link below) and
write XForms to add/remove rows in the second grid and set values in those
rows when appropriate. This way you'll be able to react to any event (row
added, removed, value changed) and do any update to the data to match the
requirements you've been given.

This will require some knowledge of XForms, so in case you don't yet have
much experience with XForms, you might want to start with the XForms
Tutorial, linked from the sidebar in the documentation.

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

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 post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet