Odd behavior in @SetViewInfo (DXL example included)

I am trying to display a form with some controls in one pane, and one of several similar views in another pane, and use the controls to control (1) which view displays and (2) what category value that view displays.

– Of course if my requirement stopped there I could use an embedded view and drop the frameset, but I need more –

I put a Hide Detail Rows checkbox on my form; checking this box switches between two views, one displaying the detail rows, the other hiding them. The odd thing is, this starts working only after several repetitions. Can anyone explain this?

The Help file doesn’t say in what context @SetViewInfo works. Obviously I’m trying to use it outside a view action button.

It’s very simple to recreate this behavior. Just import the dxl below into a new database (the necessary script is at the bottom) and open it up.

Here is the DXL. Save this as c:\r6\output.xml.

<?xml version='1.0' encoding='utf-8'?>

<database xmlns=‘http://www.lotus.com/dxl’ version=‘6.5’ replicaid=‘85256E44006B1DC9’

path=‘SetViewInfoEx.nsf’ title=‘SetViewInfo Example’ maintainunread=‘false’

allowspecialhierarchy=‘false’ overwritefreespace=‘false’>

<databaseinfo dbid=‘85256E44006B1DC9’ odsversion=‘43’ diskspace=‘458752’ percentused=‘85.8258928571429’

numberofdocuments=‘6’>20040224T143316,47-05<designmodified

20040224T154922,72-05

<aclentry name=‘CN=Thomas Kennedy/O=Towers Perrin’ type=‘person’ level=‘manager’

deletedocs=‘true’/>

<aclentry name=‘CN=PHIN24/OU=Dev/O=Towers Perrin’ type=‘server’ level=‘manager’

deletedocs=‘true’/>

02/24/2004 02:44:00 PM Thomas Kennedy/Towers Perrin updated -Default-

01/23/2004 03:58:25 PM Thomas Kennedy/Towers Perrin updated NCAdmin

01/23/2004 03:58:20 PM Thomas Kennedy/Towers Perrin updated NAAdmin

01/23/2004 03:58:16 PM Thomas Kennedy/Towers Perrin added NCAdmin

01/23/2004 03:58:16 PM Thomas Kennedy/Towers Perrin added NAAdmin

01/23/2004 03:57:59 PM Thomas Kennedy/Towers Perrin updated -Default-

01/23/2004 03:57:26 PM Thomas Kennedy/Towers Perrin added OtherDomainServers

01/23/2004 03:57:26 PM Thomas Kennedy/Towers Perrin added LocalDomainServers

01/23/2004 03:57:26 PM Thomas Kennedy/Towers Perrin added PHIN24/Dev/Towers Perrin

01/23/2004 03:57:26 PM Thomas Kennedy/Towers Perrin added Thomas Kennedy/Towers Perrin

01/23/2004 03:57:26 PM Thomas Kennedy/Towers Perrin updated -Default-

<view name=‘All’ alias=‘All’ showinmenu=‘false’ publicaccess=‘false’ designerversion=‘5’

default=‘true’ unreadmarks=‘none’ onopengoto=‘lastopened’ onrefresh=‘displayindicator’

headers=‘beveled’ opencollapsed=‘false’ showresponsehierarchy=‘false’ showmargin=‘true’

shrinkrows=‘false’ extendlastcolumn=‘false’ unreadcolor=‘black’ totalscolor=‘gray’

rowlinecount=‘1’ headerlinecount=‘1’ rowspacing=‘1’ bgcolor=‘white’ boldunreadrows=‘false’

evaluateactions=‘false’ allownewdocuments=‘false’ allowcustomizations=‘true’

hidemarginborder=‘false’ marginwidth=‘0px’ uniquekeys=‘false’ initialbuildrestricted=‘false’

noemptycategories=‘false’>

20040123T155726,69-05

20040224T143000,79-05

20040123T160503,33-05

20040224T143000,78-05

20040224T143000,78-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin<code

event=‘selection’>@All

<column sort=‘ascending’ itemname=‘$0’ width=‘31.5000’ resizable=‘true’ separatemultiplevalues=‘false’

sortnoaccent=‘true’ sortnocase=‘true’ showaslinks=‘false’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

@Text(@DocumentUniqueID)

/O

20040123T155726,73-05

20040224T143001,01-05

20040224T143001,00-05

20040224T143000,99-05

20040224T143000,85-05

CN=Thomas Kennedy/O=Towers Perrin

AiAgAQAA/gH///gAf//wAB//4AAP/8AAB//AAAP/gAAB/4AAAP+AAAD/gAAAf4AAAD+AAAA/gAAA

H4AAAA/AAAAPwAAAB8AAAAfgAAAH4AAAA/AAAAPwAAAD+AAAA/gAAAP8AAAD/gAAA/8AAAP/gAAD

/8AAA//gAAf/8AAP//wAH///AH8AAAAKoAAKoAAAAAAAAAAAAAAKpN3USgCgAAAAAAAAAAAApP1N

3d3UoKAAAAAAAAAACk/qqkCrRESgAAAAAAAAAKR+rapKCrq0SgAAAAAAAACn7traRAuruqSgAAAA

AAAKTf2tSkoKu7rqSgAAAAAACk/e1NpEC766rqSgAAAAAApNfU1ESgvrupqZSgAAAAAKTX1NREoL

67qamUoAAAAABPze1ESgu765OZmUoAAAAATG9E1AC+vruZmZmkoAAAAE9mbUqr6+vrk5mZmkAAAA

BOZjRAq7W+u5k5mZqkAAAATGadSgtb6+u9mZ4A/uAAAARmTtSgtb6+sP2U0R/gAAAEZuftoPtbuq

UdlKER/gAABPb+dA8Wu6thOZ0PEf4AAADGb0rxYbuiYZmZrhEeAAAA72ZmZmK+uiaTma4RH+AAAA

hmZmYb6+uhOTkPER/gAAAOj2Zmbl6+phOQ8REf4AAAAE5mFmLl6iFhYRERH0AAAABI9mZmXqIWFh

FhER9AAAAABI9mFmFhYWFhEREfoAAAAABI9mYWFhYWFhFhHqAAAAAABIxhYWFhYWFhER6gAAAAAA

CojxYWFhYWFhH6oAAAAAAACkCPZmFhYWEfpEAAAAAAAACkoI9mFhYW6kQAAAAAAAAACkRADu7uAK

RAAAAAAAAAAAAEREREREREAAAA==

Jz1F

Main

SetViewInfo Example

20040123T155842,45-05

20040224T143214,02-05

20040224T143214,01-05

20040224T143214,01-05

20040224T143000,87-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin

Billable_Revenue

<numberformat

format=‘fixed’ digits=‘2’ punctuated=‘false’ parens=‘false’ percent=‘false’/>

Region

<keywords columns=‘1’

borderstyle=‘inset’ ui=‘dialoglist’>EuropeUS East<text

US CentralUS West

Market

<keywords ui=‘dialoglist’

allownew=‘true’>StockholmMadrid<text

DallasPortlandChicagoVilnius

0

0

0

Revenue

0

<view name=‘Revenue By Region By Market’ showinmenu=‘false’ publicaccess=‘false’

designerversion=‘6.5’ unreadmarks=‘none’ onopengoto=‘lastopened’ onrefresh=‘displayindicator’

headers=‘beveled’ opencollapsed=‘true’ showresponsehierarchy=‘false’ showmargin=‘true’

shrinkrows=‘false’ extendlastcolumn=‘true’ unreadcolor=‘black’ totalscolor=‘gray’

rowlinecount=‘1’ headerlinecount=‘1’ rowspacing=‘1’ bgcolor=‘white’ headerbgcolor=‘white’

boldunreadrows=‘false’ evaluateactions=‘false’ allownewdocuments=‘false’

allowcustomizations=‘true’ hidemarginborder=‘false’ marginwidth=‘0px’ marginbgcolor=‘white’

uniquekeys=‘false’ initialbuildrestricted=‘false’ noemptycategories=‘false’>

20040123T160521,25-05

20040224T143548,13-05

20040224T140821,58-05

20040224T143548,12-05

20040224T143000,90-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin<code

event=‘selection’> Form=“Revenue” & Billable_Revenue != “”

<border

style=‘solid’ width=‘0px 0px 1px’/>

<column sort=‘ascending’ itemname=‘Region’ width=‘8.7500’ resizable=‘true’

separatemultiplevalues=‘true’ sortnoaccent=‘true’ sortnocase=‘true’ flatinr5=‘false’

showaslinks=‘false’ categorized=‘true’ twisties=‘true’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

Region

<column sort=‘ascending’ itemname=‘Market’ width=‘10.3750’ resizable=‘true’

separatemultiplevalues=‘true’ sortnoaccent=‘true’ sortnocase=‘true’ flatinr5=‘false’

showaslinks=‘false’ categorized=‘true’ twisties=‘true’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/>

<column totals=‘total’ hidedetailrows=‘false’ itemname=‘Billable_Revenue’

width=‘32.8750’ resizable=‘true’ separatemultiplevalues=‘false’ sortnoaccent=‘false’

sortnocase=‘true’ showaslinks=‘false’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

Billable_Revenue

AQBbkYZDdarwFF0fcwAkbiWF

/O

00<text

1

<frameset name='Main' publicaccess='false' designerversion='6.5' rows='50 50'

spacing=‘0px’ bordercolor=‘none’>

20040127T220933,63-05

20040224T151204,22-05

20040224T151204,21-05

20040224T151204,21-05

20040224T143000,92-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin

<namedelementlink

type=‘form’ name=‘Controls’/>

<namedelementlink

type=‘view’ name=‘Revenue By Region By Market - Hide Detail Rows’/>

<form name='Controls' nocompose='true' noquery='true' publicaccess='false'

designerversion=‘6.5’>

20040224T101410,43-05

20040224T154922,72-05

20040224T154922,10-05

20040224T154922,72-05

20040224T143000,99-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin

Option Public

Option Explicit

<numberformat format=‘fixed’

digits=‘0’ punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

0

<field type=‘text’ allowmultivalues=‘true’ kind=‘editable’ name=‘Regions’

listinputseparators=‘comma semicolon’ listdisplayseparator=‘semicolon’><code

event=‘defaultvalue’>vals := @Unique(@DbColumn( “Notes” : “Cache” ; “”:“” ; “(getRegions)” ; 1 ));

@If(@IsError(vals);“”;vals)

<button width=‘2in’ widthtype=‘maximum’ wraptext=‘true’ bgcolor=‘system’

name=‘btn’>@SetTargetFrame(“Data”);

@SetViewInfo( [SetViewFilter] ; “” ; “Region” ; 1 );

@If( HideDetailRows = “”;

   @Command([OpenView];"Revenue By Region By Market");

   @Command([OpenView];"Revenue By Region By Market - Hide Detail Rows")

);

@SetViewInfo( [SetViewFilter] ; ChooseRegion ; “Region” ; 1 )btn

Region

<field runexitingonchange=‘true’ usenotesstyle=‘false’ height=‘0.2500in’ width=‘3in’

multiline=‘true’ type=‘keyword’ kind=‘editable’ name=‘ChooseRegion’><keywords

helperbutton=‘false’ recalcchoices=‘true’ columns=‘1’ borderstyle=‘inset’

ui=‘combobox’>Regions<formula

@Subset(Regions;1)

<field runexitingonchange=‘true’ type=‘keyword’ allowmultivalues=‘true’ kind=‘editable’

name=‘HideDetailRows’ listinputseparators=‘comma’ listdisplayseparator=‘comma’><keywords

helperbutton=‘false’ columns=‘1’ borderstyle=‘none’ ui=‘checkbox’><textlist

Hide Detail Rows|1<formula

“1”document.forms[0].btn.click()

Instructions

This example attempts to switch between the same category value in two views, one view showing detail rows and one hiding them.

1. Choose a Region above.

2. Check & un-check Hide Detail Rows several times. You will get unpredictable results at first but <run

after several repetitions it will begin to switch between the normal view and the ‘hide detail rows’ view.

Controls

0

<view name=‘(getRegions)’ alias=‘getRegions’ showinmenu=‘false’ noreplace=‘true’

publicaccess=‘false’ designerversion=‘6.5’ unreadmarks=‘none’ onopengoto=‘lastopened’

onrefresh=‘displayindicator’ headers=‘beveled’ opencollapsed=‘false’ showresponsehierarchy=‘false’

showmargin=‘true’ shrinkrows=‘false’ extendlastcolumn=‘false’ unreadcolor=‘black’

totalscolor=‘gray’ rowlinecount=‘1’ headerlinecount=‘1’ rowspacing=‘1’ bgcolor=‘white’

headerbgcolor=‘white’ boldunreadrows=‘false’ evaluateactions=‘false’ allownewdocuments=‘false’

allowcustomizations=‘true’ hidemarginborder=‘false’ marginwidth=‘0px’ marginbgcolor=‘white’

uniquekeys=‘false’ initialbuildrestricted=‘false’ noemptycategories=‘false’>

20040224T143437,48-05

20040224T143543,18-05

20040224T143537,28-05

20040224T143543,17-05

20040224T143437,76-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin<code

event=‘selection’> form=“Revenue”

<column sort=‘ascending’ itemname=‘Region’ width=‘31.5000’ resizable=‘true’

separatemultiplevalues=‘false’ sortnoaccent=‘true’ sortnocase=‘true’ showaslinks=‘false’><columnheader

title=‘#’><datetimeformat show=‘datetime’

date=‘yearmonthday’ time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’

digits=‘0’ punctuated=‘false’ parens=‘false’ percent=‘false’/>

AQBbkYZDdarwFF0fcwAkbiWF

/O

20040224T144217,79-05

20040224T154622,25-05

20040224T154622,24-05

20040224T154622,24-05

20040224T144217,92-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin

20040224T154622,20-05

Option Public

Option Declare

Sub Initialize

Dim s As notessession

Dim db As NotesDatabase

Dim exporter As NotesDXLExporter

Dim stream As NotesStream



Set s = New notessession

Set db = s.currentdatabase

Set stream = s.createstream

Call stream.Open("c:\r6\output.xml")

Set exporter = s.CreateDXLExporter

Call exporter.setinput(db)

Call exporter.setoutput(stream)

Call exporter.process

End Sub

20040224T154622,25-05

20040224T154655,62-05

Started running agent ‘Export db to DXL’ on 02/24/2004 03:46:55 PM

Ran LotusScript code

Done running agent ‘Export db to DXL’ on 02/24/2004 03:46:55 PM

<view name=‘Revenue By Region By Market - Hide Detail Rows’ showinmenu=‘false’

publicaccess=‘false’ designerversion=‘6.5’ unreadmarks=‘none’ onopengoto=‘lastopened’

onrefresh=‘displayindicator’ headers=‘beveled’ opencollapsed=‘true’ showresponsehierarchy=‘false’

showmargin=‘true’ shrinkrows=‘false’ extendlastcolumn=‘true’ unreadcolor=‘black’

totalscolor=‘gray’ rowlinecount=‘1’ headerlinecount=‘1’ rowspacing=‘1’ bgcolor=‘white’

headerbgcolor=‘white’ boldunreadrows=‘false’ evaluateactions=‘false’ allownewdocuments=‘false’

allowcustomizations=‘true’ hidemarginborder=‘false’ marginwidth=‘0px’ marginbgcolor=‘white’

uniquekeys=‘false’ initialbuildrestricted=‘false’ noemptycategories=‘false’>

20040224T151444,25-05

20040224T151526,84-05

20040224T151513,60-05

20040224T151526,84-05

20040224T151444,28-05

CN=Thomas Kennedy/O=Towers Perrin

CN=Thomas Kennedy/O=Towers Perrin<code

event=‘selection’> Form=“Revenue” & Billable_Revenue != “”

<border

style=‘solid’ width=‘0px 0px 1px’/>

<column sort=‘ascending’ itemname=‘Region’ width=‘8.7500’ resizable=‘true’

separatemultiplevalues=‘true’ sortnoaccent=‘true’ sortnocase=‘true’ flatinr5=‘false’

showaslinks=‘false’ categorized=‘true’ twisties=‘true’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

Region

<column sort=‘ascending’ itemname=‘Market’ width=‘10.3750’ resizable=‘true’

separatemultiplevalues=‘true’ sortnoaccent=‘true’ sortnocase=‘true’ flatinr5=‘false’

showaslinks=‘false’ categorized=‘true’ twisties=‘true’><font

size=‘9pt’ style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/>

<column totals=‘total’ hidedetailrows=‘true’ itemname=‘Billable_Revenue’ width=‘32.8750’

resizable=‘true’ separatemultiplevalues=‘false’ sortnoaccent=‘false’ sortnocase=‘true’

showaslinks=‘false’><font size=‘9pt’

style=‘bold’/><datetimeformat show=‘datetime’ date=‘yearmonthday’

time=‘hourminutesecond’ zone=‘never’/><numberformat format=‘general’ digits=‘0’

punctuated=‘false’ parens=‘false’ percent=‘false’/><formula

Billable_Revenue

AQBbkYZDdarwFF0fcwAkbiWF

/O

00<text

1

20040224T154633,28-05

20040224T154633,29-05

20040224T154633,28-05

20040224T154633,28-05

20040224T154633,28-05

CN=Thomas Kennedy/O=Towers Perrin

20040224T143114,08-05

20040224T143316,47-05

20040224T143316,46-05

20040224T143316,46-05

20040224T143123,05-05

CN=Thomas Kennedy/O=Towers Perrin

800

Europe

Stockholm

20040224T143123,05-05

20040224T143146,07-05

20040224T143229,37-05

20040224T143229,36-05

20040224T143229,36-05

20040224T143146,11-05

CN=Thomas Kennedy/O=Towers Perrin

500

US East

Miami

20040224T143146,11-05

20040224T143147,06-05

20040224T143252,90-05

20040224T143252,89-05

20040224T143252,89-05

20040224T143147,10-05

CN=Thomas Kennedy/O=Towers Perrin

1000

Europe

Vilnius

20040224T143147,10-05

20040224T143147,72-05

20040224T143241,20-05

20040224T143241,19-05

20040224T143241,19-05

20040224T143147,80-05

CN=Thomas Kennedy/O=Towers Perrin

500

US West

Portland

20040224T143147,80-05

20040224T143148,32-05

20040224T143303,95-05

20040224T143303,94-05

20040224T143303,94-05

20040224T143148,37-05

CN=Thomas Kennedy/O=Towers Perrin

500

US Central

Chicago

20040224T143148,37-05

20040224T143148,97-05

20040224T143149,02-05

20040224T143149,01-05

20040224T143149,01-05

20040224T143149,01-05

CN=Thomas Kennedy/O=Towers Perrin

500

Europe

Stockholm

Here is an action button to import the DXL into a new database:

Dim ws As NotesUIWorkspace

Dim s As notessession

Dim db As NotesDatabase

Dim importer As NotesDXLImporter

Dim stream As notesstream

Dim flag As Boolean

Set ws = New notesuiworkspace

Set s = New notessession

Set stream = s.CreateStream

flag = stream.open( “c:\r6\output.xml” )

If Not flag Then

Msgbox “Could not open the xml stream - make sure the path is correct.”

Exit Sub

End If

Set db = New NotesDatabase(“”, “”)

Call db.Create(“”, “setviewinfoexample.nsf”, True)

Set importer = s.CreateDXLImporter(stream, db)

importer.ReplaceDBProperties = True

importer.ReplicaRequiredForReplaceOrUpdate = False

importer.ACLImportOption = DXLIMPORTOPTION_REPLACE_ELSE_IGNORE

importer.DesignImportOption = DXLIMPORTOPTION_CREATE

Call importer.Process

Call ws.OpenDatabase( “”, db.filepath )