Stories
PermaLink I'll be speaking at Lotusphere 09 on....XPages of course11/11/2008 03:11 AM
Domino 8.5
Here's my abstract:

Deep Dive Into Building An IBM Lotus Domino Application Powered By XPages  

An unlimited number of editable documents on the same page? Generating the type of controls for fields on page load? Dynamic applications have always been a challenge for Lotus Domino development. Not anymore! In this session learn how to utilize the power of XPages to build a survey tool that can have an unlimited number of questions. I’ll show you how to dynamically allow for the selection of controls on the page load, such as checkboxes, radio buttons, and combo boxes, etc.,. Go under the hood and see how to use multiple data sources per page and some powerful XPage controls to build this application with a minimum amount of coding.

Technorati:
(1)

PermaLink IBM bumps Microsoft from second place on brand-value list09/19/2008 09:02 AM
IBM
IBM has moved past Microsoft to claim the title of second most valuable brand in the world, according to the annual Global Brand List. IBM has moved past Microsoft to claim the title of second most valuable brand in the world, according to the annual Global Brand List.

Interbrand, a global brand management firm, reported Thursday that IBM’s brand value has increased 3 percent, to $59.03 billion, in 2008. That was enough to push it above Microsoft (Nasdaq: MSFT), which was assigned a brand value of $59 billion and fell to No. 3.

Read the full article: http://www.bizjournals.com/triangle/stories/2008/09/15/daily41.html
Technorati:
(0)

PermaLink My XPage samples and beta 2 - some bug workarounds09/14/2008 08:06 AM
Domino 8.5 - XPages
I received a number of emails from folks who were having issues with some samples on my site and DDE 8.5 beta 2.  I worked with the IBM developers this past week on solving the issues and finding workarounds.  Thanks to Phil Riand and Paul Hannan for working with me on these issues, I now have the below solutions.

There were 2 issues:

Getting a handle on the backend document that represents the current document for the page.  
- when submitting a document, in order to gain full access to the NotesDocument class representing the current document you need to use "doc=document.getDocument();" method.  For example, you would use this method to get a copy of the document when creating a response document for the current document.  With beta 2 the document was discarded after the save occurred and therefore calling this method produced an error.
- The workaround: use this to get a handle on the NotesDocument for the current document "doc=db.getDocumentByID(document.getNoteID());"

Generating dynamic controls for a document collection and binding each document to a panel.
- What was happening was the Save Data Sources simple action was failing.  This is a great feature in that it will save all bound documents that are on the page, instead of having individual save buttons.  You can also call this method in server side script by calling the Global function  "save();".
- The solution is to have the panel document binding computed on Page Load instead of Dynamically

Image:John's Blog - My XPage samples and beta 2 - some bug workarounds

If you click on the Source tab for your XPage, you can change this manually by changing the "#" to a "$" for your script bindings to the document IDs:

Image:John's Blog - My XPage samples and beta 2 - some bug workarounds

I was told that both of these issues are fixed for the GA build, so my previous examples should work without any changes when the product goes gold.

John
Technorati:
(0)

PermaLink Lotus Notes 8.5 beta 2: Want applause at your next demo? Use this new beta 2 feature...08/31/2008 08:59 AM
Domino 8.5
Demoing the new XPages Select Controls Dialog Box will guarantee applause at your next demo.  This dialog provides you the ability to drag all your Notes data fields from the data palette and select the type of control and label for each field.  It then does the following for you:

- creates a table with 2 columns and rows for each field
- creates labels for each field
- creates the appropriate control
- binds the control to the data field
- additionally, it can even add a submit button and an error message control to the page.

Developers and Managers will applaud when they see you build a new XPage in 3 minutes time.

Here's some screen shots on how it works:

In the data palette, enable the Select Controls Dialog box by right clicking on a field and selecting it:
Image:John's Blog - Lotus Notes 8.5 beta 2: Want applause at your next demo?  Use this new beta 2 feature...



Next, highlight all your fields and drag them to the XPage:
Image:John's Blog - Lotus Notes 8.5 beta 2: Want applause at your next demo?  Use this new beta 2 feature...



The dialog will then popup and allow you to make your changes to the defaults:
Image:John's Blog - Lotus Notes 8.5 beta 2: Want applause at your next demo?  Use this new beta 2 feature...



When done making changes, click the OK button and the dialog will generate the complete table:
Image:John's Blog - Lotus Notes 8.5 beta 2: Want applause at your next demo?  Use this new beta 2 feature...


You can then rearrange the rows by using the Outline View that is located at the bottom left of the IDE.  I requested that some row ordering functionality be added to the select controls dialog.  Maybe in a future release, but for right now....I'm not complaining.  This is a great feature that makes for great demos!

John
Technorati:
(0)

PermaLink Lotus Notes 8.5 beta 2 - new Design Preview for XPages08/29/2008 12:23 PM
Domino 8.5
Lotus Notes 8.5 beta 2 was released today.  Here's a link to the beta 2 download info:

http://www-10.lotus.com/ldd/nd85forum.nsf/DateAllThreadedWeb/2af77f70817fab8d852574b40061d30f?OpenDocument

For those of you who have been wanting to try out XPages, but did not want to setup a Domino server...Good news!  Beta 2 provides design preview functionality for XPages.

Here's a screen shot:

Image:John's Blog - Lotus Notes 8.5 beta 2 - new Design Preview for XPages
Technorati:
(2)

PermaLink Yellow Day tip: how to use Notes computeWithForm with an XPage08/11/2008
Domino 8.5 - XPages
Image:John's Blog - Yellow Day tip: how to use Notes computeWithForm with an XPage

I'm celebrating Yellow Day today here at GroupwareInc.  In honor of the celebration I have an XPages tip to share with you.

How to use Notes computeWithForm with an XPage
Here's how you can use your Lotus Notes default field formulas when opening up an XPage, or when saving an XPage, or both.

- Select your XPage Properties tab and click on the All Properties tab.  
- Navigate to data and expand data->dominoDocument[0].
- Select when to execute the computeWithForm form logic.  Your choices are: onload, onsave, or both

On the backend, this actually executes the document.computeWithForm() method.

Here is a screen shot:

Image:John's Blog - Yellow Day tip: how to use Notes computeWithForm with an XPage

Have a happy Yellow Day!

John
Technorati:
(0)

PermaLink XPages: Techniques for using Client-Side Javascript with Server-Side Javascript07/16/2008 04:55 AM
Domino 8.5 - XPages
XPages provides techniques that you can utilize between client-side and server-side Javascript.  I have a couple of examples below that show how you can stop server-side events from firing from a client script and also how you can retrieve values for use in client-side script using inline server-side script in your client js.

Events
Each event for a component can have both client-side and server-side Javascript.  When the event is fired the client-side script is executed first.  You can prevent/allow the server-side script from being executed by returning true or false from your client-side script.

For example, on a "Save" button you want to prompt the user and ask them if they are sure they want to save the document.  You can provide a client-side confirm popup on the onclick event.  If the user presses "OK" you would return "true" and the server-side script would then proceed to be executed.  If the user clicks "Cancel" you would return "false" and the server-side script would be prevented from being executed.

Here's a screen shot of the onclick event showing that there is a server-side simple action to save the document:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript


Here's a screen shot of the same onclick event, this time I clicked on the "Client" tab:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript


Here's the result when the button is clicked in the browser:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript


Processing server-side script in client-side script
You can process server-side script using inline commands in your client-side code.  This is a similar technique as using computed text in Domino within a page that contains Javascript.  As with Domino, the server-side code is evaluated when the page is loaded.

For example, you want to retrieve values from a Notes document and use that value in client-side script.  On the client-side onclick event for the button, you can place the following simple EL expression:
Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript


Here's the result if you click the button in your browser:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript

or you can use server-side Javascript to perform the same task as the EL expression:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript


or let's say you have a session variable from another page:

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript

or...here I am getting the database name using an @Function::

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript

Image:John's Blog - XPages: Techniques for using Client-Side Javascript with Server-Side Javascript

As you can see, you can pretty much execute any server-side Javascript to return the values you want.  This includes server-side js functions from script libraries if they are set as resources for the page.

Additional resources:
Last year there was an article written by Jason English and my good friend Sal Mazzotta for Lotus Component Designer titled Client-side JavaScript techniques and demos.  Though all of it does not apply to XPages, you can find techniques similar to the above as well as additional techniques that might be useful.

John
Technorati:
(3)

PermaLink XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 207/07/2008
Domino 8.5 - XPages
This is Part 2 of this example.  Click here to read Part 1.

How to Build It
I'll go over the steps in detail here.  The steps are actually very few.  I found that the SQL.jar file is already included in the project, so you do not need to import any jar files into the Eclipse project.  You can download the example Domino database by clicking here: XPagesJSToJava.nsf

Database Setup
Install DB2 if you haven't already.  The sample table that we will be using is Department. This is a screen shot of the table and the data.:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2
**note: I used the Administrator id when generating the sample tables so the schema is Administrator.  This might be different for you.  You will need to use the correct schema name in your query.

You will need to copy the following db2 jar files from the DB2 installation directory "SQLLIB\java\db2jcc.jar" and "SQLLIB\java\dbjcc_license_cu.jar" to your "Domino\xsp\shared\lib" directory.  There might be another way to reference the jar files by editing the Notes.ini, but this works too.


Lotus Notes Designer
Create your new Lotus Notes db XPagesJSToJava.nsf in DDE.

Now switch to the Java perspective by selecting: Window->Open Perspective->Other.  You will be presented with the below list of choices.  Select Java and click OK.
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Expand your project on the Left hand Project navigator.  Select the WebContent/WEB-INF Folder:
- right click and select New->Folder.  Name the folder source, click Finish.
- right click on the source folder and select New->Package.  Name the Package javaMethods click Finish.
- right click on the javaMethods package and select New->File.  Enter SQLQuery.java for the name.  Click Finish.  

Here's a screen shot of how it should look:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2

Now double click on the SQLQuery.java and paste in the following code:
package javaMethods;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class SQLQuery{
        public static String executeQuery(String connDB,
                        String connUserName, String connPwd, String query){
                String theResult="";
                ResultSet resultSet=null;
                try {
                        // load the DB2 Driver
                        Class.forName("com.ibm.db2.jcc.DB2Driver");
                       
                        // establish a connection to DB2
                        Connection db2Conn =
                        DriverManager.getConnection(connDB,connUserName,connPwd);
                                               
                        Statement st = db2Conn.createStatement();
                       
                        // execute the query
                        resultSet = st.executeQuery(query);
                        while (resultSet.next()) {
                                //theResult will be the 1st column separated using ";"
                                theResult=theResult+resultSet.getString(1)+";";
                        }
                }        
                catch(Exception e){
                        System.out.println(e);
                }
                return theResult;
        }
}


We need to add the source folder to the java build path:
- select the project and then select Project->Properties from the menu (or right click)
- select the Java Build Path and click on Add Folder button.  Select the new source folder.  Click OK.
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2

Your screen should look like this:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Save this and switch back to the Domino Designer perspective by selecting: Window->Open Perspective->Other.  Select Domino Designer.

We will now create the server side JavaScript library for our 2 functions.  Expand Code and then select Script Libraries and click on New Server JavaScript Library.  Enter SQLFunctions for the name. Paste in the following code.  You need to change the userName and pwd variable according to your DB2 installation.  Most likely the connString will be ok if this is on your local machine.
var connString="jdbc:db2://localhost:50000/sample";
var userName="db2admin";
var pwd="password";

function getDeptNumbers(){
        var query="SELECT DEPTNO FROM ADMINISTRATOR.DEPARTMENT";
        depts=javaMethods.SQLQuery.executeQuery(connString,userName,pwd,query);
        return @Explode(depts,";");
}

function getDepartment(deptNo){
        print("dept="+deptNo);
        var query="SELECT DEPTNAME FROM ADMINISTRATOR.DEPARTMENT WHERE DEPTNO='"+deptNo+"'";
        dept=javaMethods.SQLQuery.executeQuery(connString,userName,pwd,query);
        return dept;
}



Create the Employee form.  Here is what the form fields look like:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2

Create the Employee XPage.  If you need a refresher in creating the XPage fields, look at one of my earlier examples posted on this site.

Add a Combo Box control bound to the DepartNo field.  Click on the Values tab and click on Add Formula Item. For the formula add the JavaScript function getDeptNumbers().  Here's a screen shot:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


I added additional functionality that will look up the DepartmentName for any selected DepartNo.  Drag a new Button to the table. Change the label to Lookup.  On the Event tab for the button, select Script Editor and enter the below remark:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2
Even though the remark does nothing, it causes the page to make a round trip to the server and will compute any computed text.  Another option might have been to add that code to the onChange() event of the Combo Box. (probably a better choice in retrospect)

Add a Computed Field control to the table.  Enter the following formula that will look up the Department Name by calling the getDepartment() function:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Next we will create a view for the EmployeesView XPage.  Here's the layout:
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Create a new XPage named EmployeesView and drag a View Control to the page.  
- Make the first column a link.
- Select the View and on the Data tab, select Employee for the default XPage to open.
- Select All Properties and expand data.  Enter "detailrow" as the var.  This will allow us to reference the column values so we can perform the lookup..
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Next:
- append a new column in the view by right clicking on the Depart No. column and select Append Column.  
- click on the title for the new column and change the label to Department
- click on the column itself so we can enter a formula
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2


Click on the All Properties tab for the new column.
- expand data
- click on the value property
- click on the diamond and select Computed Value
- enter the following JavaScript formula
Image:John's Blog - XPages Example: Calling Java Methods directly from server side JavaScript - performing an SQL query Part 2

Last Steps:
- Add the JS library to the XPages.  On each XPage, select the Page properties, select the Resources tab and click Add Script Library.  Select the SQLFunctions library
- Drag a new Button Control to the page that will create new Employees
- Circle back to the Employee form and create the Save and Cancel buttons that will navigate back to the EmployeeView page.

That's it, your done!  Test it out.

Technorati:
(0)

Search
XPage Examples
By Category
My Links
Downloads
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
Calendar
November 2008
Su
Mo
Tu
We
Th
Fr
Sa
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
The BlogRoll