Тема: DominoPower Tip - A WAY TO MANAGE THE DESIGN OF PRIVATE VIEWS

Создан:Dmitry Kovalev; Heineken 12/09/2000 10:55 AM
Папка:
99. Разное
Тип сообщения:
Сообщение

Сообщение:

A WAY TO MANAGE THE DESIGN OF PRIVATE VIEWS
by Rachel Sullivan, Tivoli Systems, Inc.


Here's a problem you might have encountered before. A Private view stored on a
server contains design elements which don't update when the Shared, Private On
First Use view from which it was created undergoes a design change.


Well, here's a workaround. Used in a button (a good spot would be in an
Administration Profile document), the code below will look through every view in
the database and will delete it if it's Private. New Private views will be
created automatically the next time end-users access the database. Here's the code:


Sub Click(Source As Button)
' This script displays a list of all the views in a database,
' and displays weather they are Shared or Private.
' It goes back through and deletes all the private views.
' Lastly, it displays a list of all views again - no Private views should
be displayed.


Dim ss As New NotesSession
Dim db As NotesDatabase


On Error Resume Next

Set db = ss.CurrentDatabase
viewList = db.Views


Forall x In viewList
  If x.IsPrivate Then z$ = "Is Private" Else z$ = "Is Shared"
  txtList$ = txtList$ + x.Name + " -- " + z$ + Chr(10)
End Forall
Msgbox txtList$


Msgbox "I will now attempt to remove all Private views from the database.
Wish me luck!"
Forall y In viewList
  If y.IsPrivate Then
   Call y.Remove
  End If
End Forall


Msgbox "Ok, I did my best.  Now let's see if I was successful ...."
NewViewRevue = db.Views
txtList$ = ""
Forall a In NewViewRevue
  If a.IsPrivate Then z$ = "Is Private" Else z$ = "Is Shared"
  txtList$ = txtList$ + a.Name + " -- " + z$ + Chr(10)
End Forall
Msgbox txtList$
End Sub


Just a few warnings: This is an R5 script. This script won't work if you exclude
the "On Error Resume Next" statement. Why? Because Lotus doesn't give you a
handle to private views in a database.... Or does it?  Forcing the script to
bypass the error otherwise generated not only allows you to get a handle on the
private view and all of its properties, it even allows you to remove the view
entirely! As with any new script, be sure to backup your database before you add
and run this code.
 



Иерархия документов данной дискуссии:
DominoPower Tip - A WAY TO MANAGE THE DESIGN OF PRIVATE VIEWS (Dmitry Kovalev; Heineken) (09.12.2000 10:55:23)
.... Я что-то не понял... (Kostya V. Levkin) (09.12.2000 11:41:47)
........ Очень полезная фича. (Ivan Tsibanenko; MoscowHub) (14.12.2000 15:20:19)
.... столкнулся с тем, что isPrivate... (+) (Viktor Vladimirovich Alenkov) (03.04.2007 10:42:15)
........ замечание... (Artem S Moiseenko) (03.04.2007 12:17:27)
............ Насчет $readers каюсь.... (Artem S Moiseenko) (03.04.2007 12:21:52)
................ да нет.. .вместо $Readers можно использовать $Authors... (+) (Viktor Vladimirovich Alenkov) (03.04.2007 12:42:22)


Разработчикам и администраторам: курсы, книги, сертификация