Hello,
I have an xform having two models. The two models open the file, one of them in read/write and the other in read only. Then when data is updated, the 'autosave-shared-data' event is dispatched to submit the update and this submits successfully. But when I output the data, it still displays the previous data. How can I read the recent update in the other model's group? <xf:action ev:event="DOMActivate"> <xf:setvalue ref="instance('main-dataset-shared-data-instance')/fas-ps:position" value="index('activity-list')"/> <xf:dispatch name="autosave-shared-data" target="main-model"/> <xf:output value="concat('Data Position No: ', instance('main-dataset-shared-data-instance')/fas-ps:position)" /> <xf:group model="metadata-model" ref="/*/*[position() = instance('metadata-shared-data-instance')/fas-ps:position]"> <xf:output value="concat('Meta Position No: ', instance('metadata-shared-data-instance')/fas-ps:position)" /> </xf:group> <xf:rebuild model="main-model"/> </xf:action> |
Administrator
|
I am not sure I understand 100%. Can you provide more details?
In passing, I see in your code some xf:output and xf:group within XForms actions. Placing XForms controls within actions won't do anything at all. -Erik On Wed, Jul 27, 2011 at 11:43 AM, ibrahuma <[hidden email]> wrote: > Hello, > > I have an xform having two models. The two models open the file, one of them > in read/write and the other in read only. Then when data is updated, the > 'autosave-shared-data' event is dispatched to submit the update and this > submits successfully. But when I output the data, it still displays the > previous data. How can I read the recent update in the other model's group? > > <xf:action ev:event="DOMActivate"> > > <xf:setvalue > ref="instance('main-dataset-shared-data-instance')/fas-ps:position" > value="index('activity-list')"/> > > <xf:dispatch name="autosave-shared-data" target="main-model"/> > > <xf:output value="concat('Data Position No: ', > instance('main-dataset-shared-data-instance')/fas-ps:position)" /> > > <xf:group model="metadata-model" ref="/*/*[position() = > instance('metadata-shared-data-instance')/fas-ps:position]"> > > <xf:output value="concat('Meta Position No: ', > instance('metadata-shared-data-instance')/fas-ps:position)" /> > </xf:group> > <xf:rebuild model="main-model"/> > </xf:action> > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Accessing-data-updated-by-another-Model-in-XForms-tp3699455p3699455.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Thanks, for your response. The output controls are just for debugging output. Here is what I am trying to do:
I need to share a variable between two models, for tracking current activitiy's index in a multiple activities document. The two models represent two separate, but identical documents, one for keeping data (main-model) and the other for the corresponding timestamp (metadata-model). There is a third document for saving the shared position variable. I have an instance for this document in each of the two models. This file is modified only by a control bound to the main model. When this control is triggered, the value of the shared position is modified and saved (through submission) to the third document. As a result, the corresponding instance in the main-model reads the updated value, but the instance in the metadata-model still reads the initial value and couldn't read the updated value. How can I reload the instance in the metadata-model to read the updated value? In general terms, is it possible to access recent data in a given model, where the data update is done through another model? Thanks, for your assistance. |
Administrator
|
Cross-model interactions can be tricky.
It seems that in your case you need to use events. For example, reacting to xforms-submission-done in one model to dispatch a custom event to the second model. The second model can then react to that custom event. The function xxforms:instance('instance-id') can be useful here to access instances globally. That is, a model can then access instances from another model. You can also pass context information to events with <xxforms:context>: http://wiki.orbeon.com/forms/doc/developer-guide/xforms-events#TOC-Enhanced-xforms:dispatch-support This allows you to pass information from one model to another via events. -Erik On Thu, Jul 28, 2011 at 8:04 PM, ibrahuma <[hidden email]> wrote: > Thanks, for your response. The output controls are just for debugging output. > Here is what I am trying to do: > > I need to share a variable between two models, for tracking current > activitiy's index in a multiple activities document. The two models > represent two separate, but identical documents, one for keeping data > (main-model) and the other for the corresponding timestamp (metadata-model). > There is a third document for saving the shared position variable. I have an > instance for this document in each of the two models. This file is modified > only by a control bound to the main model. When this control is triggered, > the value of the shared position is modified and saved (through submission) > to the third document. As a result, the corresponding instance in the > main-model reads the updated value, but the instance in the metadata-model > still reads the initial value and couldn't read the updated value. How can > I reload the instance in the metadata-model to read the updated value? > > In general terms, is it possible to access recent data in a given model, > where the data update is done through another model? > > Thanks, for your assistance. > > -- > View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Accessing-data-updated-by-another-Model-in-XForms-tp3699455p3703010.html > Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com. > > > -- > You receive this message as a subscriber of the [hidden email] mailing list. > To unsubscribe: mailto:[hidden email] > For general help: mailto:[hidden email]?subject=help > OW2 mailing lists service home page: http://www.ow2.org/wws > > -- You receive this message as a subscriber of the [hidden email] mailing list. To unsubscribe: mailto:[hidden email] For general help: mailto:[hidden email]?subject=help OW2 mailing lists service home page: http://www.ow2.org/wws |
Free forum by Nabble | Edit this page |