copy or insert, elements from one instance to another

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

copy or insert, elements from one instance to another

Prameela R

 

 

Hello,

 

Can we insert  list of elements from one instance to another.

For example.

 

<xforms:instance id=”ins1”>  <xforms:instance id=”ins2”>

<data>                                     <data>

<item1>aaa</item1>                <set><value>val1</value></set>

<item 2>bbb</item2>               <set><value>val2</value></set>

</data>                                    </data>

</xforms:instance>                    </xforms:instance>

 

Can we insert the <value> in instance 1.(ins1) as below?<value/> may increae or decrease dynamically.

 

<xforms:instance id=”ins1”> 

<data>                                    

<item1>aaa</item1>

<item 2>bbb</item2>

<values>

<value>val1</value>

<value>val2</value>

</values>

</data>                                   

</xforms:instance>

 

 

Thanks,

Prameela

 



--
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
Reply | Threaded
Open this post in threaded view
|

Re: copy or insert, elements from one instance to another

Alessandro Vernet
Administrator
Prameela,

Prameela R wrote
Can we insert the <value> in instance 1.(ins1) as below?<value/> may increae
or decrease dynamically.
If I understand this correctly, you need to:

1) First insert into ins1 that <values> "container" element.
2) Then copy the <value> elements from ins2 into the <values> you just added to ins1.

Something like this should do the trick:

<xforms:action ev:event="...">
    <xforms:insert context="instance('ins1')" origin="xxforms:element('values')"/>
    <xforms:insert context="instance('ins1')/values" origin="instance('ins2')/set/value"/>
</xforms:action>

I hope this helps,

Alex
Reply | Threaded
Open this post in threaded view
|

RE: Re: copy or insert, elements from one instance to another

Prameela R
Hello Alex,

Sorry for the incomplete data.

Insertion should happen during initializing events.i.e on page load.
And instance 2 may have some more elements other than value parallel to
value element. I need only value elements to be inserted dynamically on
model-construct-done.
Do we have any event raised by xforms: repeat? Or can we insert on model
construct done event. I tried it but it did not work.

<xforms:instance id="ins1">  
<data>                          
<item1>aaa</item1>                
<item 2>bbb</item2>              
</data>                            
</xforms:instance>                  

<xforms:instance id="ins2">
<data>
<set><value>val1</value><role>rrr1<role></set>
<set><value>val2</value><role>rrr2<role></set>
</data>
</xforms:instance>

Thanks,
Prameela.

-----Original Message-----
From: Alessandro Vernet [mailto:[hidden email]]
Sent: Wednesday, May 13, 2009 12:48 PM
To: [hidden email]
Subject: [ops-users] Re: copy or insert, elements from one instance to
another


Prameela,


Prameela R wrote:
>
> Can we insert the <value> in instance 1.(ins1) as below?<value/> may
> increae
> or decrease dynamically.
>

If I understand this correctly, you need to:

1) First insert into ins1 that <values> "container" element.
2) Then copy the <value> elements from ins2 into the <values> you just added
to ins1.

Something like this should do the trick:

<xforms:action ev:event="...">
    <xforms:insert context="instance('ins1')"
origin="xxforms:element('values')"/>
    <xforms:insert context="instance('ins1')/values"
origin="instance('ins2')/set/value"/>
</xforms:action>

I hope this helps,

Alex

-----
Orbeon Forms - Web 2.0 Forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
Personal Blog: http://avernet.blogspot.com/
Twitter - http://twitter.com/avernet
--
View this message in context:
http://www.nabble.com/copy-or-insert%2C-elements-from-one-instance-to-anothe
r-tp23516340p23516638.html
Sent from the ObjectWeb 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
Reply | Threaded
Open this post in threaded view
|

RE: Re: copy or insert, elements from one instance to another

Alessandro Vernet
Administrator
Prameela,

Prameela R wrote
Insertion should happen during initializing events.i.e on page load.
And instance 2 may have some more elements other than value parallel to
value element. I need only value elements to be inserted dynamically on
model-construct-done.
Yes, you would do that xforms-model-construct-done.

Prameela R wrote
<xforms:instance id="ins1"> 
<data>                         
<item1>aaa</item1>               
<item 2>bbb</item2>               
</data>                             
</xforms:instance>                 

<xforms:instance id="ins2">
<data>
<set><value>val1</value><role>rrr1<role></set>
<set><value>val2</value><role>rrr2<role></set>
</data>
</xforms:instance>
And what would the result be in this case?

Alex