Binding to multiple datasources on a single xPage
Upcoming SlideShare
Loading in...5
×
 

Binding to multiple datasources on a single xPage

on

  • 5,128 views

Binding to multiple datasources on a single xPage

Binding to multiple datasources on a single xPage

Statistics

Views

Total Views
5,128
Views on SlideShare
5,111
Embed Views
17

Actions

Likes
1
Downloads
108
Comments
0

1 Embed 17

http://www.slideshare.net 17

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Binding to multiple datasources on a single xPage Binding to multiple datasources on a single xPage Presentation Transcript

  • xPages Example: Binding to multiple datasources on a single xPage Author: John Mackey Groupware Solutions Inc. J [email_address] Blog: http://www.jmackey.net
  • Overview
    • Unlike Lotus Notes, xPages separates the presentation layer from the data
    • This presents new opportunities and allows different approaches for Web application development
    • xPages allows multiple datasources on the same page
    • A simple action “Save Datasources” handles the updates for all bound datasources
  • Bound to Order Form Bound to Customer Form Sample Screen shot of Orders page
  • First Step: Create your Notes forms - schema
    • To get started you need to define your forms and fields
      • This is not required but the xPages IDE will not be able to provide you with drop down fields and you will not be able to drag and drop from the Data Palette, so it is beneficial to create a form.
    Here is the layout for the 2 forms:
  • Create your views
    • There are 2 standard views: Customers & Orders
      • Note: column 5 on the customers view uses @NoteID. That will be used to bind the Customer document in the Panel control. You have to strip out the “NT” prefix.
    Customers Orders
  • Create the Customer xPage
    • Create a new xPage named “Customers”
    • Set the Data Source
      • Click Data from the Properties tab
      • Click the Add button and select “Domino Document”
      • Then select the form
  • Create the Customer xPage (cont.)
    • Next click on the Data palette link (this is cool!)
      • Note: I noticed sometimes you need to click someplace on the form first before the Data Palette shows the fields
      • Select all the fields and drag them to the page canvas. You can rearrange or change them later
      • This will automatically create edit box controls in a table and setup the proper bindings
  • Create the Orders xPage
    • Follow the same basic steps from the Customer Page
      • Create the new xPage named “Orders”
      • Set the datasource
      • Drag drop the fields
    • Replace the “CustomerName” edit box control with a combobox control
      • re-bind it to the CustomerName from the Data properties tab
      • Click on the Values tab and add a Formula item:
        • @DbColumn(@DbName(),"vCustomers",1)
  • Create the Orders xPage (cont)
    • Add a default label of “--select--” with a value of 0
    • use the “Up” arrows to position it as the first element
  • Create the Orders xPage (cont)
    • Drag a Panel control to the page – this is where we bind the customer data to the xPage
      • Name it “CustomerData”
      • Click on the Data tab for the panel and create a new Domino Document datasource named “customerDoc”, the form is “Customer”, the action is “Edit document”
  • Create the Orders xPage (cont)
    • We need to supply a document Id for the customer record
      • Note: xPages use the document NoteId
      • We will grab the NoteId from a lookup to the vCustomers view
      • Click on the “Document ID” formula and enter the following Computed formula
  • Create the Orders xPage (cont)
    • Add the Customer fields to the Panel
      • Click on the Data palette link
      • Drag and drop the fields you want to the Panel
      • Note: I replaced the ShippingInstructions with a Multi-line editbox in the below example
  • Create the Orders xPage (cont)
    • We need to set a property on the Panel control so that the Panel ignores any request parameters for the Orders page.
      • For example: the page receives and uses parameters such as “editDocument” and “documentID”. For this use case we calculate the documentID for the Panel and so we want to ignore the page parameters.
      • Click on the All Properties on the Properties tab for the “CustomerData” Panel
      • Expand Data and set “ignoreRequestParams” to true
  • Create the Orders xPage (cont)
    • We need to make the page refresh when the Customer Name changes in the combobox
      • Select the CustomerName combobox
      • Select the Events tab and then the onChange event
      • Include the following formula
  • Create the View xPage
    • You will need to create a view page for navigation
      • Create a new xPage named “ViewCustomers”
      • Drag a Tabbed control to the page
        • Create 2 tabs (right click – insert tab)
        • Name one “Customers”, the other “Orders”
      • Drag a view control to the Customer tab
        • Select your vCustomers view as the source
        • Do the same for Orders and select the vOrders view as the source
  • Create the View xPage (contd.)
    • Make the first column a link
      • Select the CustomerName column and set the link property
      • Also, select the view and set the “open selected documents using” property on the data tab
      • Do the same steps for the Orders view
    Link property Form to use
  • Create the View xPage (contd.)
    • Create 2 buttons so you can add Customers and Orders
      • Drag a button
      • Use the following simple action (substitute for Orders)
  • Final Steps
    • Add the save buttons to the Orders & Customers page
      • Drag a button
      • Select “Simple action” – Save Data Sources
      • Select the “ViewCustomers” page to open next
    • Set the default xPage to open for the database on the database properties launch tab
  • Test the Application
    • Create some Customers
    • Create some Orders and change the Customer information from the Orders page
    • Navigate to the Customer’s page and verify the Customer information was updated when the save occurred
  • Questions??
    • Contact me if you have any questions
      • [email_address]
    • or comment on my blog: http://www.jmackey.net
    • The Domino 8.5 discussion forum is:
      • http://www-10.lotus.com/ldd/nd85forum.nsf