04/12/2007

Using XML for Domino (DXL) and some warnings

Some months ago I was developing an application for Lotus Notes clients: I wanted to build a dinamic list/table into a Notes document where each row had to show information about a Spare Parts item.

Each row had to contain the following information:
- a spare part code
- a description
- a quantity
- a LotusScript button to process that specific spare part code (let's say something like "add this item/code to the shopping cart"...)




The numbers of items in the Spare Parts list/table could not be a fixed number.

I decide to use DXL = XML for Domino
By the way, using DXL classes you can export/import data document from/to a Notes database, just dealing with text XML files.
Reading the Designer Help db you can find info about LS classes to work with DXL:
NotesDXLexporter and NotesDXLimporter classes.

Everything was fine with that application on Lotus Notes client release 6.5.x ... until we upgraded to release 7.

I suddenly could NOT see anymore the dynamic-sized spare parts list/table into any R7/R8 Lotus Notes client because the DXL importer could NOT load the all DXL file prepared by another LS procedure!

No problems with R6.5.x clients, just with R7 clients users.

I realized I could see the log of the DXL importer class, that is printing the Log property soon after the run-time error.
"Warning: Memory allocation request exceeded 65,000 bytes"

I was not worried by the warning message: "as soon it was not a fatal importer error..."
But I was wrong, in fact the Spare Parts list/table did not show into the document!

After some search I found the following IBM technote # 1255264 :
Message 'Warning: Memory allocation request exceeded 65,000 bytes' importing a DXL file
and I setup DXL_DISABLE_LS_COMPILE=1 var into the Notes.ini.

It just resolved any troubles in Lotus Notes clients R6.5.1, R7 and R8.

See the following PDF document with a sample LS function createSparePartsTable() that take care of building the dynamic Spare Parts list/table using data from the array parameter (2nd parameter) and storing the generated table into a richtext item (body) inside the origdoc parameter (1st parameter).


Happy DXL!

PDF document: http://www.divshare.com/download/2995732-eb6

5 comments:

Clarke said...

excellent post Cristian,
just a quick question.

If you had already created a table in your rich text field and you want to append a row to the existing table, how would you do that?

do you just export the rich text as dxl, parse the dxl to find the position in the dxl output to add the next row and then reimport it? or is that more complicated than it sounds?

Cristian D'Aloisio said...

Hi Clarke,
yes, I would give a try like you said.
But I also would take a look to this post from Joe Litton.

Clarke said...

Cristian,

I tried that approach without sucess. Navigating a rich text table using the notesrichtextnavigator class is the way to go just so long as you don't insert a button or an action hotspot into the table because its not possible to append a rich text item (in my case an action hotspot) after a 'begininsert' call. text,urls are ok but I want insert an action hostpot that will run some lotusscript, identical to your table just replacing the button with an action hotspot. I also need to be able to add more rows to the table at any time in the future. dxl or c-api seems to be the only solution.

Cristian D'Aloisio said...

DXL will be the righ choice, C API are not easy, I guess.

I suggest you to make a table with buttons/hotspots on a test Notes, then export it to DXL: later you study the DXL output code and try build a custom DXL text file to be imported: have a look here

Anonymous said...

I found this site using [url=http://google.com]google.com[/url] And i want to thank you for your work. You have done really very good site. Great work, great site! Thank you!

Sorry for offtopic