adding elements to existing data

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

adding elements to existing data

Ron Peterson
Hi,

I'm new to Orbeon, and really like it so far.  I've built my first form,
which is basically a revised version of the Bookcast example
application, and I've come up with a couple of questions.

* I've added an element to my form, and it works just fine for new
  entries, but there's no entry field for existing entries.  I'd like a
  blank field (or maybe filled out w/ a default value) to show up for
  existing entries.  What's the right approach here?  I can add an empty
  element in my eXist database directly - but is that the
  usual/recommended approach?

* I've noticed that when validating my form against a schema, that date
  type elements automatically get a date picker added to them.  Nice!
  However, it only show up _after_ I've added a date.  How can I turn
  that on for the initial date entry?

Using 3.7.1 BTW.

TIA.

--
Ron Peterson
Network & Systems Manager
Mount Holyoke College


--
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: adding elements to existing data

Erik Bruchez
Administrator
> I'm new to Orbeon, and really like it so far.

Thanks!

> I've built my first form,
> which is basically a revised version of the Bookcast example
> application, and I've come up with a couple of questions.
>
> * I've added an element to my form, and it works just fine for new
>  entries, but there's no entry field for existing entries.  I'd like a
>  blank field (or maybe filled out w/ a default value) to show up for
>  existing entries.  What's the right approach here?  I can add an  
> empty
>  element in my eXist database directly - but is that the
>  usual/recommended approach?
The larger issue is: how to migrate data from a version v1 of an XML  
schema (as in "structure of an XML document", not as in "W3C XML  
Schema") to version v2?

In general answer is not easy.

For your specific case, since you know what changed, I think that yes,  
you could migrate all of your existing data by simply adding a blank  
element to all your documents. If you are using eXist, this should be  
easy with just a bit of XQuery.

> * I've noticed that when validating my form against a schema, that  
> date
>  type elements automatically get a date picker added to them.  Nice!
>  However, it only show up _after_ I've added a date.  How can I turn
>  that on for the initial date entry?

If the data type is not correct (an empty string is not an xs:date!),  
the schema validator we are using does not report that the element  
contains a value of type xs:date.

In this case, you better use an additional bind:

   <xforms:bind nodeset="..." type="xs:date"/>

or:

   <xforms:bind nodeset="..." type="xforms:date"/>

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.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: adding elements to existing data

Anthony4321
Erik Bruchez wrote
> I've built my first form,
> which is basically a revised version of the Bookcast example
> application, and I've come up with a couple of questions.
>
> * I've added an element to my form, and it works just fine for new
>  entries, but there's no entry field for existing entries.  I'd like a
>  blank field (or maybe filled out w/ a default value) to show up for
>  existing entries.  What's the right approach here?  I can add an  
> empty
>  element in my eXist database directly - but is that the
>  usual/recommended approach?

The larger issue is: how to migrate data from a version v1 of an XML  
schema (as in "structure of an XML document", not as in "W3C XML  
Schema") to version v2?

In general answer is not easy.

For your specific case, since you know what changed, I think that yes,  
you could migrate all of your existing data by simply adding a blank  
element to all your documents. If you are using eXist, this should be  
easy with just a bit of XQuery.
I've only just come across Orbeon Forms and have never had to use XQuery before. Could you please provide an example of how you would do this within eXist?

We will be doing many form changes that we will want to be retroactive and all the open standards in Orbeon look appealing. As long as the changes are new elements or leave element identifiers the same this shouldn't break anything correct?

Cheers
Reply | Threaded
Open this post in threaded view
|

Re: Re: adding elements to existing data

Erik Bruchez
Administrator
> I've only just come across Orbeon Forms and have never had to use XQuery
> before. Could you please provide an example of how you would do this within
> eXist?

You mean migrating XML data? Not in just 2 minutes, unfortunately.

This said the idea is smilar to any database migration script: write
the script (here written with XQuery), and run it on data that needs
to be migrated. XQuery allows you to select documents in database
collections, iterate over them, read and update those documents. So
all the basic tools to migrate data are in the language.

> We will be doing many form changes that we will want to be retroactive and
> all the open standards in Orbeon look appealing. As long as the changes are
> new elements or leave element identifiers the same this shouldn't break
> anything correct?

It depends which way you go. If you edit old form data with a new
version of the form that has new fields, those fields won't appear,
unless the data has been migrated. If that's acceptable, then great,
otherwise you need to migrate the data first.

-Erik


--
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