After using the DbColumn and DbLookup code I posted a while back I found another thing that needed solving.
Frequently I want these functions to only return unique values. But placing @Unique around the function calls gives the empty result as before for a repeat control if the result of the function is a single value, a string in effect.
So I added a line of code and a parameter to the functions to be able to request unique values (see the code below).
DbLookup
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
DbColumn
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
Monday, 28 March 2011
Monday, 21 March 2011
Another Lotussquash coming up, 7 april - Apeldoorn
Last year in Q4 we picked up the Lotussquash initiative and agreed to have a Lotussquash event approximately every 3 months.
The next Lotussquash will be on the 7th of april in Apeldoorn (NL) and is organised by Clear IT Consulting.
More information can be found on their blog.
I hope to see you there.
The next Lotussquash will be on the 7th of april in Apeldoorn (NL) and is organised by Clear IT Consulting.
More information can be found on their blog.
I hope to see you there.
Wednesday, 23 February 2011
Improved caching for Xpages DbLookup and DbColumn
A while back I blogged about a failing repeat control in Xpages when passing it a single value returned from a @DbLookup or @DbColumn. In the comments to this entry it was already mentioned by some that it needs an array as input.
The other week I received a reply from IBM on my PMR (87011,211,788) stating exactly that, "The repeat control works as designed, it needs an array as input.".
From the earlier comments on that blogpost I had already started using the suggested solution from the xpages wiki by Julian Buss.
But like in the Notes client not every situation calls for cached results, so I amended this code to allow for cache or not. And instead of requestScope I used sessionScope as I want the cache to last until the session is ended (browser closed/session times out).
If you want to use it, put the code below in a server side JavaScript library and you are ready to use it.
DbLookup
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
DbColumn
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
The other week I received a reply from IBM on my PMR (87011,211,788) stating exactly that, "The repeat control works as designed, it needs an array as input.".
From the earlier comments on that blogpost I had already started using the suggested solution from the xpages wiki by Julian Buss.
But like in the Notes client not every situation calls for cached results, so I amended this code to allow for cache or not. And instead of requestScope I used sessionScope as I want the cache to last until the session is ended (browser closed/session times out).
If you want to use it, put the code below in a server side JavaScript library and you are ready to use it.
DbLookup
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
DbColumn
The code has been moved and can be found here: http://notesnl.blogspot.com/2011/09/final-version-of-dblookuparray.html
Sunday, 13 February 2011
My thoughts on Lotusphere 2011 #ls11
My fourth Lotusphere
This Lotusphere is my fourth. I had the opportunity to go in 1996, 1998, 2008 and now in 2011. This time I was together with my collegue Dennis van Remortel.
The overall experience and excitement of watching great content in the sessions and sharing ideas and thoughts with peers and speakers was just super again and made up for the disappointing number of announcements from IBM this year.
I will definitely try to be back for the 2012 edition.
So finally, after a couple of days back home now, after visiting our collegues of InterfaceFLOR in the US, I think it is time to start writing down my thoughts.
Opening session
Many comments have already been made about this session which can be summarised as too much over rehearsed customer content and to little technical content and demoes. IBM clearly had very little to announce this year. The "next" releases were mentioned without a clear end date. Hopefully we will see some great announcements next year. I hope IBM realise they need to keep the pace to keep/regain the lead.
The guest speaker, Kevin Spacey, possibly made the best impression and touching on the core of the Lotus community, "send the elevator down" to help others learn/expand their skills and knowledge
Remarkable: Later it was announced that almost 1 in 5 attendees at the opening session had been using an iPad!!!
Students?
Yes students, in the opening session 500 students were welcomed to the Lotusphere Opening day (lets hope the OGS didnot turn them off) on invitation of Group Business Software and IBM to get a glimpse of the wonderfull world of yellow. Way to go, students are the link to the future.
IBM
Not sure if it was only me, but I noticed a lot of attendees from IBM this year (blue badges). Coincidence or was it to fill up unsold seats.
Cloud
This years breakout sessions and sundays jumpstart sessions had to make up for lack of news in the opening session. I chose for a mix of strategic and technical sessions. The technical sessions to see how things can be done and the strategic to see the capabilities of products like Sametime Unified Telephony and Connections and to start thinking about how my company could benefit from using these. Very nice to see the transfer of a single phone call being moved to the computer and to the mobile phone. And furthermore the integration of it all into the notes client as well IBM effort to move it all to the cloud with lotuslive, soon even existing Notes applications.
Highlights from the technical sessions:
- Xpages blast - 30 very usefull tips in 60 minutes. Outstanding.
- Symphony - the robust IBM, open source alternative, to MS office
- the increasing extension of the power of mobile devices
- xpages, xpages, xpages - build powerfull webapplications in lotus notes RAD style
- dojo - quickly enhance the user experience
Jeopardy
The closing session was awesome. IBM presented a brief demo of the sametime setup that was put in place to ensure a smooth safety organisation at the coming Superbowl match in Fort Worth. It showes the technology is ready to support mission critical communications. The next thing was the line up of the Watson computer to play a game of Jeopardy against some very skilled Lotusphere attendees. No mean feat to get a computer to understand the finesses of human language, interpret the meaning and coming up with the right solution. Later in february Watson will compete with the best Jeopardy players in the US to show its capabilities. Fingers crossed for Watson!
Energy
In the four times I have been so far, even though spread over several years, each time I found I come back with lots of energy that will last for months on end and at least until the next registration period for Lotusphere comes around. I got home with lots of ideas and things to explore from the technical session I watched.
Thank you
I would like to end this entry with a thank you to all the staff at IBM that work very hard at making this great event happen every year.
And of course thank you to all the people I met at this years Lotusphere.
This Lotusphere is my fourth. I had the opportunity to go in 1996, 1998, 2008 and now in 2011. This time I was together with my collegue Dennis van Remortel.
The overall experience and excitement of watching great content in the sessions and sharing ideas and thoughts with peers and speakers was just super again and made up for the disappointing number of announcements from IBM this year.
I will definitely try to be back for the 2012 edition.
So finally, after a couple of days back home now, after visiting our collegues of InterfaceFLOR in the US, I think it is time to start writing down my thoughts.
Opening session
Many comments have already been made about this session which can be summarised as too much over rehearsed customer content and to little technical content and demoes. IBM clearly had very little to announce this year. The "next" releases were mentioned without a clear end date. Hopefully we will see some great announcements next year. I hope IBM realise they need to keep the pace to keep/regain the lead.
The guest speaker, Kevin Spacey, possibly made the best impression and touching on the core of the Lotus community, "send the elevator down" to help others learn/expand their skills and knowledge
Remarkable: Later it was announced that almost 1 in 5 attendees at the opening session had been using an iPad!!!
Students?
Yes students, in the opening session 500 students were welcomed to the Lotusphere Opening day (lets hope the OGS didnot turn them off) on invitation of Group Business Software and IBM to get a glimpse of the wonderfull world of yellow. Way to go, students are the link to the future.
IBM
Not sure if it was only me, but I noticed a lot of attendees from IBM this year (blue badges). Coincidence or was it to fill up unsold seats.
Cloud
This years breakout sessions and sundays jumpstart sessions had to make up for lack of news in the opening session. I chose for a mix of strategic and technical sessions. The technical sessions to see how things can be done and the strategic to see the capabilities of products like Sametime Unified Telephony and Connections and to start thinking about how my company could benefit from using these. Very nice to see the transfer of a single phone call being moved to the computer and to the mobile phone. And furthermore the integration of it all into the notes client as well IBM effort to move it all to the cloud with lotuslive, soon even existing Notes applications.
Highlights from the technical sessions:
- Xpages blast - 30 very usefull tips in 60 minutes. Outstanding.
- Symphony - the robust IBM, open source alternative, to MS office
- the increasing extension of the power of mobile devices
- xpages, xpages, xpages - build powerfull webapplications in lotus notes RAD style
- dojo - quickly enhance the user experience
Jeopardy
The closing session was awesome. IBM presented a brief demo of the sametime setup that was put in place to ensure a smooth safety organisation at the coming Superbowl match in Fort Worth. It showes the technology is ready to support mission critical communications. The next thing was the line up of the Watson computer to play a game of Jeopardy against some very skilled Lotusphere attendees. No mean feat to get a computer to understand the finesses of human language, interpret the meaning and coming up with the right solution. Later in february Watson will compete with the best Jeopardy players in the US to show its capabilities. Fingers crossed for Watson!
Energy
In the four times I have been so far, even though spread over several years, each time I found I come back with lots of energy that will last for months on end and at least until the next registration period for Lotusphere comes around. I got home with lots of ideas and things to explore from the technical session I watched.
Thank you
I would like to end this entry with a thank you to all the staff at IBM that work very hard at making this great event happen every year.
And of course thank you to all the people I met at this years Lotusphere.
Wednesday, 19 January 2011
Xpages - Combobox - set first choice to blank
In Xpages the combobox works different from what you are used to in the Notes form equivalent, the dialog list field.
In Notes if you get the choices using an @DbColumn or @DbLookup, assign no default value and the user does not consciously pick a value, no value is assigned to the field.
But when you do that with a combobox in Xpages, the first value in the list of choices will be assigned to the field.
Usually that is not what I want, I want the user to make a conscious choice. And assigning a default value of a space does not help if that value is not in the list of choices. So you will have to add a blank value as the first option in the list of choices.
I found 2 ways to solve this and it eliminates the need to set a default value.
1. The simplest way is to add a space as the first label-value pair and for the second add the rest of the choices using @DbColumn/@DbLookup.
2. Insert a blank value in the javascript code that retrieves the list of choices using @DbColumn/@DbLookup. This is probably the better method if you also want to include code to do some form of cache. See the code sample below.
In Notes if you get the choices using an @DbColumn or @DbLookup, assign no default value and the user does not consciously pick a value, no value is assigned to the field.
But when you do that with a combobox in Xpages, the first value in the list of choices will be assigned to the field.
Usually that is not what I want, I want the user to make a conscious choice. And assigning a default value of a space does not help if that value is not in the list of choices. So you will have to add a blank value as the first option in the list of choices.
I found 2 ways to solve this and it eliminates the need to set a default value.
1. The simplest way is to add a space as the first label-value pair and for the second add the rest of the choices using @DbColumn/@DbLookup.
2. Insert a blank value in the javascript code that retrieves the list of choices using @DbColumn/@DbLookup. This is probably the better method if you also want to include code to do some form of cache. See the code sample below.
// get the cached result if used before
var list = sessionScope.<cachename>;
// if no cached values found, create it
if (!list) {
// create an array with 1 blank entry as first entry
var arr = new Array(" ");
var res = @DbLookup("", "<a view>", "<a key>", 2);
// append the retrieved values to the array
var list = arr.concat(res);
sessionScope.<cachename> = list;
}
return list;
Tuesday, 18 January 2011
Lotusphere 2011 agenda app for Android
For the Android adepts it is good to know that there is also a ls11 agenda app available. Search for "lotusphere" in the market and you will find the LS11 agenda app posted by Joseph Jaquinta based on the geniisoft version.
Dave Hay also mentions it on his blog.
As for the mix up of names. The app is written by Jo Grant (as Dave mentions), but appearantly posted in the market by Joseph Jaquinta.
It has a nice and simple layout and good options to filter and tag your favorite sessions.
thanx Jo !!
You will also find a LS11 app in the market from Sogeti, a game with a nice reward for the winner?!
Dave Hay also mentions it on his blog.
As for the mix up of names. The app is written by Jo Grant (as Dave mentions), but appearantly posted in the market by Joseph Jaquinta.
It has a nice and simple layout and good options to filter and tag your favorite sessions.
thanx Jo !!
You will also find a LS11 app in the market from Sogeti, a game with a nice reward for the winner?!
Thursday, 6 January 2011
Xpages and the failing Repeat control
I am converting an application to Xpages and use the repeat control to build several levels of dynamic menu structures.
They are based on simple @DbColumn and @DbLookup. But when the result array is only one entry the repeat control fails. The code below shows the failing repeat control (xp:link simplified to keep the code clean).
[Note: single results from @DbColumn or @DbLookup are returned as string and not an array.]
I have filed a service request (PMR) with IBM. Please do the same if you think this should be solved!
[Note: IBM have responded to the PMR: The repeat control works as designed and expects an array as input.]
Thesolution workaround is implemented in the code below.
They are based on simple @DbColumn and @DbLookup. But when the result array is only one entry the repeat control fails. The code below shows the failing repeat control (xp:link simplified to keep the code clean).
[Note: single results from @DbColumn or @DbLookup are returned as string and not an array.]
<xp:repeat id="repeat1" rows="30" var="rowData" indexVar="rowIndex">
<xp:this.value><![CDATA[#{javascript:
@Unique(@DbLookup("", "xpSectionList", sessionScope.regionFilter, 2))
}]]></xp:this.value>
<li>
<xp:link escape="true" id="linkSubSection" title="#{javascript:rowData}">
<xp:this.text><![CDATA[#{javascript:rowData}]]></xp:this.text>
</xp:link>
</li>
</xp:repeat>
After some searching I found a solution in the LDD by Bob Cross, "Hint for Repeating a single value".Repeat controls are great - but they MUST return an array, even if it is just one entry.The proposed solution works fine and does solve the problem, but I consider it a workaround for a bug. The repeat control should also work when a single value is returned.
In my example, I used a repeat control to display entries from a dblookup. However, some of my lookups only returned one entry, so the result was a string, not an array. Since the result of my dblookup was a string, the repeat control would not display the one returned result.
The solution is to convert the result to a string first by using valueOf(). This returns a string delimited by commas. Then split the result by the commas to get an array. If split fails, then the result was an array to start with.
var tmpstr = result.valueOf();
try {
var newarr = tmpstr.split(",");
return(newarr)
}
catch(err){
return(tmpstr);
}
I have filed a service request (PMR) with IBM. Please do the same if you think this should be solved!
[Note: IBM have responded to the PMR: The repeat control works as designed and expects an array as input.]
The
<xp:repeat id="repeat1" rows="30" var="rowData" indexVar="rowIndex">
<xp:this.value><![CDATA[#{javascript:
var result = @Unique(@DbLookup("", "xpSectionList", sessionScope.regionFilter, 2));
var tmpstr = result.valueOf();
try {
var newarr = tmpstr.split(",");
return(newarr)
}
catch(err){
return(tmpstr);
}
}]]></xp:this.value>
<li>
<xp:link escape="true" id="linkSection" title="#{javascript:rowData}">
<xp:this.text><![CDATA[#{javascript:rowData}]]></xp:this.text>
</xp:link>
</li>
</xp:repeat>
Subscribe to:
Posts (Atom)
