Unhiding A Notes Database Design

When a Notes database has its design hidden in R4, the formulas and LotusScript
code are irretrievably scrambled. However, if you have the original design in a
template whose design isn't hidden, you can "unhide" the design of the database
as a whole, then replace the individual scrambled design elements from your

I strongly advise you experiment on a local copy of the database before trying
to apply this technique to a production application.

Since this technique makes an end run around the Notes front end and accesses
the database file directly, it will only work with a local replica of a
database. If the database is on a server, you may have to delete the server
replica and re-create it from the local file when you're done unhiding the

1. Don't have the database you want to unhide open in Notes. Delete its icon
from your Notes workspace (but don't delete the database file).

2. Create a mail message or other document containing an RTF, not in the
database whose design you want to unhide. Alternatively, you could create an
agent in some database and use the code shown below there.

3. In the Body field of the mail message (or other RTF) create a button. Put
the LotusScript code which appears below into the button.

4. Click the button, and enter the filename of the application database whose
design is hidden (note: not the filename of the template). This script bypasses
Notes and works directly on the NSF file, resetting the flag that tells Notes
that the design is hidden.

5. You can now reopen the database and see the design views. However, if you
try to look at any formulas or script code you'll find them still hidden, since
as mentioned before, the macro and script source code are scrambled.

6. The next step is to replace the scrambled formulas with their original
unscrambled versions. Do this using File Database Replace Design. Select the
template from which the application database inherits its design.

You should now be able to see all formulas and script code, with the possible
exception of some agents, which for some reason are not always replaced during
the design replace. You'll need to delete these agents and repeat the Design
Refresh to replace these agents with their unhidden originals.
Sub Click(Source As Button)
Close ' all open files
Dim fname$, fn, db As notesdatabase, template$
Const INDEX = &hbd ' byte position of the hide design flag in an NSF file.
Const MASK = &b11011111 ' bit mask to locate the hide design flag in that

fname = Inputbox("enter filename: ", "UNHIDE DESIGN", "")
If Trim(fname) <> "" Then
' open the file as a Notes database to make sure it's a valid Notes
Set db = New notesdatabase("", fname)
If db Is Nothing Then
Msgbox "Not a valid Notes database: " & fname
Elseif Not db.isopen Then
Msgbox "Cannot locate database: " & fname
Delete db ' remove this object from memory

fn = Freefile() ' grab an available file number
Open fname For Binary Access Read Write Lock Read Write As fn
Seek fn, INDEX
tex = Input(1, fn)
oldCode = Asc(tex)
Print "oldCode = " & Hex(oldCode)

newCode = (oldCode And MASK)
If oldCode = newCode Then
Msgbox "The database design doesn't appear to be hidden."
Seek fn, INDEX
tex = Chr$(newCode)
Put #fn, INDEX, tex
Seek fn, INDEX
tex = Input(1, fn)
Msgbox "tex = " & Hex(Asc(tex))
End If
End If
End If
End Sub

This was first published in November 2000

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.