I’m looking to use DXL to create a web-based view that a user can change on the fly (from standard to categorized, for example). I’m looking at the DXL classes to try and make this happen, and it looks like the DXLImport function is primarily for importing DXL elements in as documents. But what I want to do is write an agent that builds the DXL dynamically and outputs it as a Notes view. For example, the user clicks an icon beside the column heading to categorize a view by that column, which triggers an agent that streams in the existing DXL, transforms it to a categorized view, and sends it back to the browser as a Notes view.
Is there a way to do this with LotusScript or Java agents? I want to avoid creating DXL files on the server file system, if possible, but if that’s the only way to go then I’ll do it.
Yes, DXL export and import is only for notes (design notes and documents), not for the data in views. It is not clear why you are even thinking of doing it this way. Why not just use ordinary views, and provide buttons that switch between them?
Thanks for the reply. The reason I’m doing it this way is that the alternative would require me to create hundreds of views ahead of time. Not only do I want people to switch between standard and categorized views, I want them to be able to change the order of the columns on the browser and categorize by any column they wish. The views I’m working with have from 10-12 columns each, so the permutations would quickly add up.
I don’t want to change the view data in the database; I only want to display changes dynamically on the browser. For example, if I have a view with three columns, (Column A, Column B, and Column C), and if the user wants to change the column order so that Column B is before Column A, then I want to take the DXL for the existing view in Column ABC order, transform it to DXL that would generate a view with Column BAC order, and output this DXL to the browser as a Notes view with the new column order. (Note that I’m not saving the new view to the database – I’m just displaying it to the user).
So can I create DXL within an agent and display it on the browser? I tried a simple agent to do this, but it crashed notes when I tried to open the stream:
Sub Initialize
'This agent adds documents to current database
Dim session As New NotesSession
Dim db As NotesDatabase
Set db = session.CurrentDatabase
Dim stream As NotesStream
Set stream = session.CreateStream
str_dxl = |<?xml version="1.0" encoding="UTF-8">| & Chr(10)
str_dxl = str_dxl & |<viewentries toplevelentries="1">| & Chr(10)
str_dxl = str_dxl & |<viewentry position="1" unid="73DEC4A3644CACA885256DF70049243E" noteid="8F6" siblings="1">| & Chr(10)
str_dxl = str_dxl & |<entrydata columnnumber="0" name="$0">| & Chr(10)
str_dxl = str_dxl & |<textlist>| & Chr(10)
str_dxl = str_dxl & |<text>1</text>| & Chr(10)
str_dxl = str_dxl & |</textlist>| & Chr(10)
str_dxl = str_dxl & |</entrydata>| & Chr(10)
str_dxl = str_dxl & |</viewentry>| & Chr(10)
str_dxl = str_dxl & |</viewentries>| & Chr(10)
If Not stream.Open(str_dxl) Then
Messagebox "Can't open"
Exit Sub
End If
Call stream.Truncate
I’m confused as to why you would do things this way. Best would seem to be outputting the view as DXL (via ?ReadViewEntries) then transforming it for display via XSLT on the browser. You ought to be able to handle the reordering by simply applying different templates to the already present DXL.
When you use a browser to look at a view, Domino sends HTML, not DXL, to the browser. To output a different colum order, your agent could get the data from the view and do the conversion to HTML itself. This would allow you to generate all those permutations from a small number of basic views.