Generare in automatico la vista da una FORM

TIPS DEVELOPERS

  • 0 commenti
Questo script permette di Generare una Vista di una FORM scelta dal Database corrente...

**************************************
Sub Initialize
Dim s As New NotesSession
Dim w As New NotesUIWorkspace
Dim db As NotesDatabase
Dim frm As NotesForm
Dim vw As NotesView
Dim frmName As String
Dim c As NotesViewColumn
Redim frmNames(0) As String

Set db=s.CurrentDatabase
i=0
frmNames(i)=""
Forall x In db.Forms
i=i+1
Redim Preserve frmNames(i) As String
frmNames(i)=x.name
End Forall

frmName=""
frmName=w.Prompt(PROMPT_OKCANCELLIST, "Select a Database", "Select a database to open.", "",frmNames)
Set vw=db.CreateView(frmName,{SELECT FORM = "}+frmName+{"})

'-----------------------------------------------
' Elimination of automatically created columns
'-----------------------------------------------
i=0
Forall columna In vw.Columns
i=i+1
End Forall
For j=1 To i
vw.RemoveColumn
Next

Set frm=db.GetForm(frmName)
Forall f In frm.Fields
If frm.GetFieldType(f)<&gt1 Then
 Set c=vw.CreateColumn(,f,f)
 Print frm.GetFieldType(f)
 Select Case frm.GetFieldType(f)
 Case AUTHORS,NAMES,READERS,1281
  a$={@name([Abbreviate];}+c.Formula+{)}
  c.Formula=a$
 Case DATETIMES,1024
  c.TimeDateFmt=0    
  c.DateFmt=6
 
 Case NUMBERS,768
  c.NumberAttrib=2
 End Select
 '----------------------------------------------------------------------
 ' Special cases of columns of type names non-detected by GetFieldType
 '----------------------------------------------------------------------
 If Left$ ( f , 2 )="us" Then
  a$={@name([Abbreviate];}+c.Formula+{)}
  c.Formula=a$
 End If
 c.FontFace="Arial"
 c.HeaderFontFace="Arial"
 c.FontPointSize=9
 c.HeaderFontPointSize=9
 c.FontStyle=0
 c.HeaderFontStyle=0
End If
End Forall
End Sub

**************************************

0 Commenti:

    Nessun Commento Trovato
Commenta articolo
 

Questo spazio web è stato creato da per un uso pubblico e gratuito. Qualsiasi tipo di collaborazione sarà ben accetta.
Per maggiori informazioni, scrivete a info@dominopoint.it

About Dominopoint
Social
Dominopoint social presence: