Uniquely identifying repeated elements

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

Uniquely identifying repeated elements

Confix
Hi,

I'm using Orbeon 4.6 with the REST Persistence API to save the data users would submit to my own backend. This all works quite smoothly, but I would like to uniquely identify any repeated elements that users submit. Without this, I for example can't accurately detect which elements were added, modified or deleted.

To make it a bit more explicit: suppose I have a 'My Bookshelf' form (how original!), with in it a repeated grid with 'title' and 'author' fields. The data returned by Orbeon after a single submission could look like this:

<form><book><title>catcher in the rye</title><author>J.D. Salinger</author></book></form>

Now suppose the user edits this form, and the data returned now is:

<form><book><title>The Catcher in the Rye</title><author>J.D. Salinger</author></book><book><title>Brave New World</title><author>Aldous Huxley</author></book></form>

I cannot accurately detect which element was added, and which was merely modified.
Could anyone please give me some pointers on how I could go about doing this?
Reply | Threaded
Open this post in threaded view
|

Re: Uniquely identifying repeated elements

Erik Bruchez
Administrator
It makes sense, and I don't think there is a perfect solution right now.

But you could:

- add an empty output field to each repeat
- make that field non-relevant (hidden)
- set a calculation to set the value of field to a unique id if that field is blank

-Erik