Monday, 24 September 2012

Notes error: Field is too large (32k) or ....

"Notes error: Field is too large (32k) or View's column & selection formulas are too large". I ran accross this error last week and it took a while to solve, as the error is not as descriptive as it seems.
The error occurred in a lotusscript agent while updating a document after receiving and processing an xml response from a webservice. As the agent is not dealing with changing views or view selection formulas, the problem had to be at field level.
Initially the error indicated its location in the code to be when storing the xml as an attachment on the document. But attachments are stored in rich text fields so that would be impossible.
While debugging the first thing I found is that the error would not occur at the moment an item/field would grow beyond the 32k limit, but at the moment the NotesDocument.Save method is called.
I did find a field that grew past the 32k limit, and solved it by changing the field type to richtext. But still the agent kept nagging with the 32k message.
Debugging on, it took a couple of hours of trial and error and googling around to find what was causing this next 32k limit error.
After a while I discovered that the content of the xml could occasionally contain large numbers repeating data and the agent processes this into 4 fields per repeat. The xml I discovered this on contained a 700+ repeat resulting in 2800+ extra fields on the form. As field summary was not disabled on the fields, this seemed to be causing a 32k message and excluding this code in a next debug run with the same xml confirmed this as no error was produced.
Eventually I solved the problem by replacing these 4 fields per repeat, into combining them in one richtext field using a richtext table.

Conclusion: The error message is a bit misleading, as adding more than 32k characters to a normal text field will cause a 32k error (but we already knew that), but adding lots of fields to a form with field summary enabled (which is default) can also cause this message when the total field summary exceeds the 32k limit.

This is what IBM writes about the error.

Tuesday, 18 September 2012

First Xpages & beer session

After some discussions between a couple of xpages developers, Martin Meijer, Mark Leusink and the guys from Clear IT Consulting organised the first Xpages & beer session in Hengelo (ov), the Netherlands on wednesday 12 september 2012.

The format is simple have a couple of presentations and discussions and finish with a beer.
The presentations for this first edition were by

The idea is continue this initiative every quarter and the second edition is planned for wednesday 12 december 2012 at the e-Office location in Houten (NL).
So if you missed the first edition, put the next one on your calendar. See you there.

I really enjoyed watching the presentation and talking about xpages development and will definitely be there for the next edition.
A big thank you to Martin, Mark and Wim  for organising the first Xpages & Beer

Photo courtesy of Clear IT Consulting

Wednesday, 11 April 2012

"Invalid or nonexistent document" with embedded object on form

There seems to be a problem with embedded objects stored in the design of a form. I recently came accross this bug at a client site. They use an embedded word document object on a form to allow the users to create templates for letters. These letters are used on the dossiers they handle for their customers/clients.
This problem or bug is introduced with the latest release of Lotus Notes, 8.5.3. The bug only occurs when creating new documents based on saving the form after editing and saving the object. Copies made of old documents continue work as before.


An apar already exists (LO65725) but for now it doesnot seem IBM will solve it anytime soon. A pity as the suggested workaround *1) is difficult to implement in applications that already have dozens of documents based on the design with the embedded object.

I created another workaround which works perfectly on my clients applications. I have created a Lotusscript function that will create a new copy of an already existing document (created before the 8.5.3. ugrade) (regular copy/paste is not allowed in the application).
This dedicated document is a stripped version of what they normally use. And to keep the users from accidentally changing or deleting it I have hidden it for the views the users are using.

I have found one other article (by Sonja Schiffer) on this problem on the web, so I thought it might be worthwhile sharing.


*1) the suggested workaround is to work with attachments, detach edit save and reattach to the document.
Obviously not very handy in an already existing application, but a good idea for new applications.

Wednesday, 14 March 2012

1st LotusSquash of 2012, Deventer, 29 march



LotusSquash: playing squash with other Lotus geeks - a friendly training session open for players of all levels and Lotus geeks of all levels - a quarterly event organised around the country.
Non Lotus geeks are welcome too ;-)

It is also an alternative, nice and sporty way of networking and chatting about IBM Lotus stuff. Watch for updates via twitter #lotussquash.
Let us know if you want to join via twitter or post a comment here.

Next LotusSquash:
Date: thursday 29 march
Time: 19:00 hrs
Where: Sportbedrijf Deventer
Address: Piet van Donkplein 1, 7422LW Deventer (NL)
Organised by: Clear IT Consulting

Wednesday, 21 December 2011

agent.RunOnServer - cannot create automated object

The other day I had to make some changes to process an incoming html page containing client data from a paid service.
To limit the access to this service, it can only be called from the domino servers. And is currently done  through a scheduled agent.
But now some users also need to be able to call the service on demand. To keep the restriction of calling only from a domino server I created a lotusscript button that runs the process via an agent.RunOnServer call.
This agent is reusing the code from the scheduled agent and does a CreateObject of the MSXML service to handle the incoming html/xml.
It constantly failed with an error message "cannot create automated object" on the console.
After some searching and a tip by Dennis van Remortel I found a technote (21088529) through the LDD forum that explained this error and how to work around it. It notes it affects releases 5, 6 & 6.5, but appearantly it is still valid for 8.5.x as well!!

The workaround is to create another agent that is called from the client button with the RunOnServer method an to have this agent call the original agent with the Run method.

Tuesday, 22 November 2011

XSnippets - do not reinvent the wheel


A gem for code sharing was launched about a month ago on OpenNTF, XSnippets
. It contains small re-usable chunks of code related to Xpages.
The UI is very simple and userfriendly and finding that codefragment you need in your next project should not be a problem. The code snippets are even colour coded.

Hopefully all those great contributors of code to the Notes Domino community will gradually copy their pieces of code to this site. That would make XSnippets the place to look first and avoid reinventing the wheel.

Monday, 10 October 2011

Xpages Internationalisation

Working in Europe for a multinational, providing a multi-lingual website is not an option, it is a must. So the option for internationalisation in Xpages is very welcome.
The standard xpages localisation option (in the application properties) creates a properties file per specified language per custom control/xpage. Works great, but it does create a lot of maintenance work if things needs changing afterwards or when you add a language.
There is another option available which is not as automated like the xpages localization, but in the long run will probably turn out to be more flexible when doing maintenance or adding an extra language.
Here is how it works:

- For every language create a properties file, a flat text file with the extension .properties and make them available to the application through the "file resources". For ease of use name these files something like english.properties, dutch.properties, etc. In the properties files add name-value pairs separated by the equals sign (=) for labels, buttons etc. in your applocation that you want translated.
     login_text=Login
     logout_text=Logout
     menu_text=Menu
     ....

- In a custom control that loads on every page in the application, e.g. an initialisation custom control, in the resources properties add a resource bundle, name it something like "lang" and compute the location to the desired language properties file, e.g. using the browser language setting or for testing as simple as below..
     return "/dutch.properties";

- Next go through all the xpages and custom controls and change the fixed text of labels, buttons, etc. by a value from the properties file set in the resources.
     lang.login_text

- After setting all the necessary entries in the properties file for the default language, create the file resources (copy) for the other languages. To spot not translated labels in the application, you can prefix them with the target language.
     login_text=[EN]Login
     logout_text=[EN]Logout
     menu_text=[EN]Menu
     ....

This process is best done at the end of the development phase of a project and work with a default language until than.

Used sources:
xpages101.net

LND Application dvlp wiki