Help with model instance

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

Help with model instance

JohnBampton
Hello, I have to load an xml file into an instance.  But the problem is I don't know how many times the element "DNA-DATANARR" is going to appear.  How do i set up my model instance to accomodate for this?
Below is what I have so far, will this work when there are multiple "DNA-DATANARR" elements?

<xforms:model id="main-model">
<xforms:instance id="data-instance">
<data>
        <TRADACOMS09-PORDER>
                <ORDERS>
                        <DNA-DATANARR>
                                <SEQA01-LINESEQNO>SEQA01-LI</SEQA01-LINESEQNO>
                        </DNA-DATANARR>
                </ORDERS>
        </TRADACOMS09-PORDER>
</data>
</xforms:instance>
</xforms:model>

Regards,

John.
Reply | Threaded
Open this post in threaded view
|

Re: Help with model instance

Alessandro  Vernet
Administrator
John,

On Sun, Oct 18, 2009 at 5:01 AM, JohnBampton <[hidden email]> wrote:
> Hello, I have to load an xml file into an instance.  But the problem is I
> don't know how many times the element "DNA-DATANARR" is going to appear.
> How do i set up my model instance to accomodate for this?
> Below is what I have so far, will this work when there are multiple
> "DNA-DATANARR" elements?

Yes, you can definitely have multiple elements with the same name at
the same level. Then in general you will use an <xforms:repeat> to
iterate over those elements and create as many form fields as
necessary depending on how many <DNA-DATANARR> you end up having in
the XML.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Help with model instance

JohnBampton
Hi,

no the xml elements are not going to be form controls.  They just happen to be in the xml file that I am importing.  So I don't know whether I am going to have just one element or multiple elements.  so how do i set up my instance?

Regards,

John.


Alessandro Vernet wrote
John,

On Sun, Oct 18, 2009 at 5:01 AM, JohnBampton <jbampton@gmail.com> wrote:
> Hello, I have to load an xml file into an instance.  But the problem is I
> don't know how many times the element "DNA-DATANARR" is going to appear.
> How do i set up my model instance to accomodate for this?
> Below is what I have so far, will this work when there are multiple
> "DNA-DATANARR" elements?

Yes, you can definitely have multiple elements with the same name at
the same level. Then in general you will use an <xforms:repeat> to
iterate over those elements and create as many form fields as
necessary depending on how many <DNA-DATANARR> you end up having in
the XML.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Help with model instance

Alessandro  Vernet
Administrator
John,

On Sun, Oct 18, 2009 at 6:20 PM, JohnBampton <[hidden email]> wrote:
> no the xml elements are not going to be form controls.  They just happen to
> be in the xml file that I am importing.  So I don't know whether I am going
> to have just one element or multiple elements.  so how do i set up my
> instance?

I am not sure to understand: you are saying that those elements are
going to be in the "XML you import". So this means that they will end
up in an instance, right? How would that be a problem?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Re: Help with model instance

JohnBampton
So if I am loading an instance with a load submission do I need to define the instance with xml in the model first in the page?

Regards,

John.


Alessandro Vernet wrote
John,

On Sun, Oct 18, 2009 at 6:20 PM, JohnBampton <jbampton@gmail.com> wrote:
> no the xml elements are not going to be form controls.  They just happen to
> be in the xml file that I am importing.  So I don't know whether I am going
> to have just one element or multiple elements.  so how do i set up my
> instance?

I am not sure to understand: you are saying that those elements are
going to be in the "XML you import". So this means that they will end
up in an instance, right? How would that be a problem?

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Help with model instance

Alessandro  Vernet
Administrator
John,

On Sun, Oct 18, 2009 at 9:37 PM, JohnBampton <[hidden email]> wrote:
>
> So if I am loading an instance with a load submission do I need to define the
> instance with xml in the model first in the page?

You need to have something in the instance, even it it is going to be
replaced right away because you are running a <xforms:submission> on
xforms-model-construct-done. What I often do in this case it to have
an element <dummy/> in the instance, to signal that this element isn't
relevant.

Alex
--
Orbeon Forms - Web forms, open-source, for the Enterprise
Orbeon's Blog: http://www.orbeon.com/blog/
My Twitter: http://twitter.com/avernet


--
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
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet