PermaLink XPages Example: updating data from multiple forms from a single xPage06/09/2008
Domino 8.5 - XPages
* please note: This example has been updated to work with 8.5 Gold.

I put together an example of using XPages to update data from multiple forms on a single XPage.  There is a sample database for you to download as well as a presentation that walks you through the steps involved.

XPages separates the presentation layer from the data layer.  This is obviously very different to the one to one relationship in Domino.  XPages also allows the developer to bind to multiple datasources from a single page.  This feature can really provide a different approach to developing Domino applications.

I came up with the following simple use case:  We have an application where the user takes product orders that are shipped to customers.  Sometimes the user needs to update the customer information while taking the order.  We can provide the Customer fields right on the Order form and bind them via a Panel control to the Customer form.  A single button with a simple action saves all the bound datasources for the page and therefore updates both forms for us.  Here is a screen shot:

Image:John's Blog - XPages Example: updating data from multiple forms from a single xPage

Here are the downloads:
- CustomerOrders.nsf
- step-by-step powerpoint

Download the application and try it out.  Contact me if you have any questions via posting or email.  My email address is in the powerpoint (created with Symphony however!).

John

Technorati:
This page has been accessed 6957 times. .
Comments :v

1. John Turnbow06/09/2008 01:50:50 AM
Homepage: http://www.recondite2.com


John,

Thanks for this. I am just getting into reviewing and testing R8.5. Nice way to put it all together.

John Turnbow




2. jjtb somhorst06/09/2008 09:40:54 PM


Pretty good introduction on the subject.




3. K Vijaya Kumar07/08/2008 01:53:30 PM
Homepage: http://www.qafco.com.qa


Dear John,

Excellent design concept the xpage is,

I appreciate your contribution for us to early adoption

Regards




4. Shu07/08/2008 11:11:24 PM


Excellent resource to preview the feature! I don't see the theme as reflected in your screenshot, though. Could you provide it as part of the download?




5. John Mackey07/09/2008 11:02:29 AM
Homepage: http://www.jmackey.net


@Shu, that actually is funny. I should do an example on using themes...maybe soon.

That is a screen shot of the powerpoint presentation that you can download, which has the nice ppt theme...thanks to Microsoft

John




6. Edwin10/18/2008 03:28:29 AM
Homepage: http://www.viresto.nl


Thanks for your introduction on the Xpages of Lotus.




7. Roland Reddekop02/01/2009 05:56:14 AM
Homepage: http://www.bleedyellow.com/blogs/sanitycheck/


Hi John,
I've tried this out in 8.5 gold release and all 3 xpages are giving me Error500 when previewing in Designer. Have you verified if its working in the final release? Could just be me.




8. John Mackey02/01/2009 07:57:58 AM


@Roland, thanks for pointing this out. The XPages just needed to be re-saved so that they compiled with the latest libraries. I tries a "clean" but that did not seem to work. I also needed to change the documentid formula on the Panel control on the Orders XPage. The @DbLookup no longer returns an array if there is only one document found. I updated the download on the site.




9. Veer02/19/2009 12:09:57 PM


Hi John,
Great example.

I hit upon a bug while learning from this.

When doing a New Order and changing the customer names back and forth, the name doesn't change consistently.

Also, saving the document after each change seems to be awkward. Is there no other way around this?

Thanks




10. Matt T03/22/2009 11:33:51 PM


Hi John,

The bug that was referenced on 2/19 I ran into the same thing. When changing the names it saves however if you hit cancel or close the new order is still there, have you found any way around this?

Thanks
Matt
Great work!




11. John Mackey03/23/2009 10:34:20 AM
Homepage: http://www.jmackey.net


@10, Hi Matt. I looked into this. Since in this example I use the Customer Name as the key, I force a save on the onchange event so that the panel that is bound to the customer is reloaded. I think you could replace this with setting a session variable and not saving.

The other issue is that we don't know if any of the order details have changed. So I should actually perform a "save()" as opposed to a "document.save()" when a customer name is changed. The context.reloadPage() will not retain the values and the changes will be lost.




12. Ethio12/07/2009 05:19:41 AM
Homepage: http://www.hdebruijn.nl


Thanks for the information.




Search
Partner with us
Need help on your XPages projects?

Talk to the experts! Read more...
XPage Examples
By Category
About Me
Downloads
My Links
Monthly Archive
Powered by
Blogsphere
Lotus Domino ND7 RSS News Feed RSS Comments Feed Geo URL netcraft RSS Validator Lotus Geek Chris. A. Brandlehner OpenNTF BlogSphere