Wipe them out - all of them (when a design refresh doesn't work)
You created that shiney new version of your application, ran (in no particular order) fixup, compact and updall and replaced the design. Still some of the design elements haven't updated. Typically that happens when no attention was paid to the "prohibit design refresh" flag of the database design (all your predecessor's fault of course).
While you can go in and hunt the settings down one-by-one (tip: use an DXL export and just look for the property), it is sometimes faster and more profound to strip the offending database(s) from their design entirely before applying the "Replace Design" action.
To do that I use a script in my little universal toolbox. A word of caution:
While you can go in and hunt the settings down one-by-one (tip: use an DXL export and just look for the property), it is sometimes faster and more profound to strip the offending database(s) from their design entirely before applying the "Replace Design" action.
To do that I use a script in my little universal toolbox. A word of caution:
- Use it at your own risk
- Backup the database beforehand
- Check in Domino Designer's "Navigator view" (the Eclipse panel, not a Notes view) that they are all gone
- You have been warned
%REM
Class DesignWiper
Description: Wipes out entire design of a database
DEADLY for any folders that are user created
DEADLY on templates
Use at your own risk!
%END REM
Public Class DesignWiper
private db As NotesDatabase
%REM
Sub New
Description: The database is handed over in the constructor
%END REM
Sub New (dbToWipe As NotesDatabase )
Set me. db = dbToWipe
End Sub
%REM
Sub wipeDesign
Description: Wipes all design, might spare folders
%END REM
Public Sub wipeDesign (preserveFolders As Boolean )
Dim morituri As NotesNoteCollection
Dim curId As String
Dim nextId As String
If me. thisIsATemplate ( ) Then
MsgBox "I won't kill a template"
Exit sub
End If
'Select all elements and walk backwards
Set morituri = db. Createnotecollection ( true )
Call morituri. Selectalladminnotes ( false )
Call morituri. Selectalldatanotes ( false )
If preserveFolders Then
morituri. Selectfolders = false
End If
Call morituri. Buildcollection ( )
curId = morituri. Getfirstnoteid ( )
Do Until curId = ""
nextId = morituri. Getnextnoteid (curId )
Call me. wipeOne (curId )
curId = nextId
Loop
MsgBox "It is done, please run fixup, compact and design replace"
End Sub
%REM
Sub wipeOne
Description: Wipes one design element
might go wrong, so the error handler skips it
%END REM
Private Sub wipeOne (Noteid As String )
Dim doc As NotesDocument
On Error GoTo Err_wipeOne
Set doc = me. db. Getdocumentbyid (Noteid )
If Not doc Is Nothing Then
Call doc. Remove ( true )
End if
Exit_wipeOne:
Exit Sub
Err_wipeOne:
Print "Error removing " & NoteId & "(Error: " & CStr ( Err ) & " - " & Error$
Resume Exit_wipeOne
End Sub
%REM
Function thisIsATemplate
Description: checks if the database is a template
%END REM
Private Function thisIsATemplate As Boolean
thisIsATemplate = (db. Templatename <> "" )
End Function
End Class
Class DesignWiper
Description: Wipes out entire design of a database
DEADLY for any folders that are user created
DEADLY on templates
Use at your own risk!
%END REM
Public Class DesignWiper
private db As NotesDatabase
%REM
Sub New
Description: The database is handed over in the constructor
%END REM
Sub New (dbToWipe As NotesDatabase )
Set me. db = dbToWipe
End Sub
%REM
Sub wipeDesign
Description: Wipes all design, might spare folders
%END REM
Public Sub wipeDesign (preserveFolders As Boolean )
Dim morituri As NotesNoteCollection
Dim curId As String
Dim nextId As String
If me. thisIsATemplate ( ) Then
MsgBox "I won't kill a template"
Exit sub
End If
'Select all elements and walk backwards
Set morituri = db. Createnotecollection ( true )
Call morituri. Selectalladminnotes ( false )
Call morituri. Selectalldatanotes ( false )
If preserveFolders Then
morituri. Selectfolders = false
End If
Call morituri. Buildcollection ( )
curId = morituri. Getfirstnoteid ( )
Do Until curId = ""
nextId = morituri. Getnextnoteid (curId )
Call me. wipeOne (curId )
curId = nextId
Loop
MsgBox "It is done, please run fixup, compact and design replace"
End Sub
%REM
Sub wipeOne
Description: Wipes one design element
might go wrong, so the error handler skips it
%END REM
Private Sub wipeOne (Noteid As String )
Dim doc As NotesDocument
On Error GoTo Err_wipeOne
Set doc = me. db. Getdocumentbyid (Noteid )
If Not doc Is Nothing Then
Call doc. Remove ( true )
End if
Exit_wipeOne:
Exit Sub
Err_wipeOne:
Print "Error removing " & NoteId & "(Error: " & CStr ( Err ) & " - " & Error$
Resume Exit_wipeOne
End Sub
%REM
Function thisIsATemplate
Description: checks if the database is a template
%END REM
Private Function thisIsATemplate As Boolean
thisIsATemplate = (db. Templatename <> "" )
End Function
End Class
Posted by Stephan H Wissel on 05 April 2012 | Comments (b) | categories: Show-N-Tell Thursday