Government forms mod, output number of forms + 1 on the actual new form

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

Government forms mod, output number of forms + 1 on the actual new form

                                   
To generate the numbers in the column.

How to do I modify one of the form to display this number + 1 on the form itself via an xforms:output field?

Regards,

John
JohnBampton
Hello,

I am modifying the government forms example.  On the opening form page there is a table with headings:

No.   Date Saved   Name Birth Date ID No. Vehicle

I would like to be able to display the form number (No.) which is automatically generated on the front page in my form when I click new form.  So if there are 2 forms in the table I would like to display a field in my form that have the number 3.  On the first page with the table you are using

<xforms:repeat nodeset="instance('documents-instance')/documents/document" id="documents-repeat">
                               
                                        <xforms:output value="count(preceding-sibling::document) + 1"/>
                                   
Reply | Threaded
Open this post in threaded view
|

Re: Government forms mod, output number of forms + 1 on the actual new form

Alessandro  Vernet
Administrator
John,

By "on the form itself", I assume you mean when opening a specific
form? To do that, you'd have to get the list of the forms, sort them
in the same order used on the summary page, and find in which position
the current form is. If you want the forms to have "natural" small
number (1, 2, 3...), instead of doing this, I would rather add code to
generate that number when the form is created, and store it as part of
the form data.

Alex

On Fri, Apr 16, 2010 at 10:52 PM, JohnBampton <[hidden email]> wrote:

>
> Hello,
>
> I am modifying the government forms example.  On the opening form page there
> is a table with headings:
>
> No.   Date Saved        Name    Birth Date      ID No.  Vehicle
>
> I would like to be able to display the form number (No.) which is
> automatically generated on the front page in my form when I click new form.
> So if there are 2 forms in the table I would like to display a field in my
> form that have the number 3.  On the first page with the table you are using
>
> <xforms:repeat nodeset="instance('documents-instance')/documents/document"
> id="documents-repeat">
>                                <tr>
>                                    <td>
>                                        <xforms:output
> value="count(preceding-sibling::document) + 1"/>
>                                    </td>
>
> To generate the numbers in the column.
>
> How to do I modify one of the form to display this number + 1 on the form
> itself via an xforms:output field?
>
> Regards,
>
> John
>
> --
> View this message in context: http://n4.nabble.com/Government-forms-mod-output-number-of-forms-1-on-the-actual-new-form-tp2013874p2013874.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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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: Government forms mod, output number of forms + 1 on the actual new form

JohnBampton
Hi,

Do you have some example code that I can use? Because I can't figure it out and this is the last customization of the government forms example that I need for my prototype.

Regards,

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

Re: Re: Government forms mod, output number of forms + 1 on the actual new form

Alessandro  Vernet
Administrator
John,

Sorry, I don't have sample code for this. You could maintain a
document in eXist with the last sequence number used, and when the
form is created read and update that number. I would also check if
eXist does not already provide a facility to do that (similar in
functionality to the create sequence myseq / myseq.nextval of Oracle).
But that seems like a lot of trouble to just have a "good looking" id
to me ;).

Alex

On Mon, Apr 19, 2010 at 7:42 PM, JohnBampton <[hidden email]> wrote:

>
> Hi,
>
> Do you have some example code that I can use? Because I can't figure it out
> and this is the last customization of the government forms example that I
> need for my prototype.
>
> Regards,
>
> John.
> --
> View this message in context: http://n4.nabble.com/Government-forms-mod-output-number-of-forms-1-on-the-actual-new-form-tp2013874p2016840.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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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: Re: Government forms mod, output number of forms + 1 on the actual new form

Alistair Miles-2
Hi John,

I know eXist 1.4 does have a "counter" xquery function module to
manage persistent counters.

I was looking at the exist online function library docs for a link
[1], but the online docs have been updated to reflect the 1.5
developmental version and the counter module has disappeared - i'll
ask the exist folks where it's gone.

exist's util module also has a uuid() function.

cheers,

Alistair

[1] http://demo.exist-db.org/exist/xquery/functions.xql

On Tue, Apr 20, 2010 at 03:32:52PM -0700, Alessandro Vernet wrote:

> John,
>
> Sorry, I don't have sample code for this. You could maintain a
> document in eXist with the last sequence number used, and when the
> form is created read and update that number. I would also check if
> eXist does not already provide a facility to do that (similar in
> functionality to the create sequence myseq / myseq.nextval of Oracle).
> But that seems like a lot of trouble to just have a "good looking" id
> to me ;).
>
> Alex
>
> On Mon, Apr 19, 2010 at 7:42 PM, JohnBampton <[hidden email]> wrote:
> >
> > Hi,
> >
> > Do you have some example code that I can use? Because I can't figure it out
> > and this is the last customization of the government forms example that I
> > need for my prototype.
> >
> > Regards,
> >
> > John.
> > --
> > View this message in context: http://n4.nabble.com/Government-forms-mod-output-number-of-forms-1-on-the-actual-new-form-tp2013874p2016840.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
> >
> >
>
>
>
> --
> Orbeon Forms - Web forms, open-source, for the Enterprise -
> http://www.orbeon.com/
> 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


--
Alistair Miles
Centre for Genomics and Global Health <http://cggh.org>
The Wellcome Trust Centre for Human Genetics
Roosevelt Drive
Oxford
OX3 7BN
United Kingdom
Web: http://purl.org/net/aliman
Email: [hidden email]
Tel: +44 (0)1865 287669


--
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: Re: Re: Government forms mod, output number of forms + 1 on the actual new form

Alessandro  Vernet
Administrator
Alistair,

I would also be interested in knowing more about that counter module,
if you find more. Thanks for the info.

And regarding eXist's uuid() function, if it is more convenient do
generate an UUID in XForms than XQuery, you can use a <xforms:setvalue
ref="..." value="digest(string(random(true)), 'MD5', 'hex')"/>.

Alex

On Wed, Apr 21, 2010 at 2:50 AM, Alistair Miles
<[hidden email]> wrote:

> Hi John,
>
> I know eXist 1.4 does have a "counter" xquery function module to
> manage persistent counters.
>
> I was looking at the exist online function library docs for a link
> [1], but the online docs have been updated to reflect the 1.5
> developmental version and the counter module has disappeared - i'll
> ask the exist folks where it's gone.
>
> exist's util module also has a uuid() function.
>
> cheers,
>
> Alistair
>
> [1] http://demo.exist-db.org/exist/xquery/functions.xql
>
> On Tue, Apr 20, 2010 at 03:32:52PM -0700, Alessandro Vernet wrote:
>> John,
>>
>> Sorry, I don't have sample code for this. You could maintain a
>> document in eXist with the last sequence number used, and when the
>> form is created read and update that number. I would also check if
>> eXist does not already provide a facility to do that (similar in
>> functionality to the create sequence myseq / myseq.nextval of Oracle).
>> But that seems like a lot of trouble to just have a "good looking" id
>> to me ;).
>>
>> Alex
>>
>> On Mon, Apr 19, 2010 at 7:42 PM, JohnBampton <[hidden email]> wrote:
>> >
>> > Hi,
>> >
>> > Do you have some example code that I can use? Because I can't figure it out
>> > and this is the last customization of the government forms example that I
>> > need for my prototype.
>> >
>> > Regards,
>> >
>> > John.
>> > --
>> > View this message in context: http://n4.nabble.com/Government-forms-mod-output-number-of-forms-1-on-the-actual-new-form-tp2013874p2016840.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
>> >
>> >
>>
>>
>>
>> --
>> Orbeon Forms - Web forms, open-source, for the Enterprise -
>> http://www.orbeon.com/
>> 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
>
>
> --
> Alistair Miles
> Centre for Genomics and Global Health <http://cggh.org>
> The Wellcome Trust Centre for Human Genetics
> Roosevelt Drive
> Oxford
> OX3 7BN
> United Kingdom
> Web: http://purl.org/net/aliman
> Email: [hidden email]
> Tel: +44 (0)1865 287669
>
>
> --
> 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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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: Re: Re: Government forms mod, output number of forms + 1 on the actual new form

Jasper Linthorst
Hi Alex, Alistair,
Stumbled upon this thread while looking for a way to generate UUID's from xforms. Isn't there a way to call the java function uuid:createPseudoUUID() like we can do with the (unsafe-)xslt processor? Using the digest(string(random(true)), 'MD5', 'hex') doesn't return a UUID following the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.

Furthermore I read you were interested in more info on exists Counter module. This is something I contributed to eXist last year in order to maintain sequential persistent id's generated in a synchronized context.

If you add or uncomment this in you conf.xml:

<module class="org.exist.xquery.modules.counter.CounterModule"
                    uri="http://exist-db.org/xquery/counter"/>

and reload the documentation. You should be able to look it up under the http://exist-db.org/xquery/counter namespace. In short in comes down to:

counter:create($counter-name as item()) xs:long?
counter:create($counter-name as item(), $init-value as xs:long) xs:long?
counter:destroy($counter-name as item()) xs:boolean?
counter:next-value($counter-name as item()) xs:long?

Regards,
Jasper
Reply | Threaded
Open this post in threaded view
|

Re: Re: Re: Re: Re: Government forms mod, output number of forms + 1 on the actual new form

Alessandro  Vernet
Administrator
Jasper, Alistair,

Yes, good point, you can call uuid:createPseudoUUID() from XForms. For instance:

<xforms:output value="uuid:createPseudoUUID()"
xmlns:uuid="org.orbeon.oxf.util.UUIDUtils"/>

Alex

On Wed, Nov 24, 2010 at 3:51 AM, Jasper Linthorst
<[hidden email]> wrote:

>
> Hi Alex, Alistair,
> Stumbled upon this thread while looking for a way to generate UUID's from
> xforms. Isn't there a way to call the java function uuid:createPseudoUUID()
> like we can do with the (unsafe-)xslt processor? Using the
> digest(string(random(true)), 'MD5', 'hex') doesn't return a UUID following
> the xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx format.
>
> Furthermore I read you were interested in more info on exists Counter
> module. This is something I contributed to eXist last year in order to
> maintain sequential persistent id's generated in a synchronized context.
>
> If you add or uncomment this in you conf.xml:
>
> <module class="org.exist.xquery.modules.counter.CounterModule"
>                    uri="http://exist-db.org/xquery/counter"/>
>
> and reload the documentation. You should be able to look it up under the
> http://exist-db.org/xquery/counter namespace. In short in comes down to:
>
> counter:create($counter-name as item()) xs:long?
> counter:create($counter-name as item(), $init-value as xs:long) xs:long?
> counter:destroy($counter-name as item()) xs:boolean?
> counter:next-value($counter-name as item()) xs:long?
>
> Regards,
> Jasper
> --
> View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Government-forms-mod-output-number-of-forms-1-on-the-actual-new-form-tp2013874p3057119.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
>
>


--
Orbeon Forms - Web forms, open-source, for the Enterprise -
http://www.orbeon.com/
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