Shows All Views in Excel Dynamically

This Content Component encountered an error

Create an excel module and create 2 list boxs. Name it as mentioned in the script. Copy and paste this script to the module. It will go through all the database in your server (u can change to local or other server).

It will list out all the views available in the database. Select any view and it will shows all the records with the title :). This is a shortcut for users rather than have to buy another product to do reporting like seagate or brio.

p/s i just copy and paste the code below, it seems scattered, rearrange it to make it work again. Another thing create a button to run "PopulateDB" sub first. Contact me if u have any enquiries :)

Code:
Sub Report()
  Dim session As Object
  Dim r As Integer
  Dim db As Object
  Dim view As Object
  Dim doc As Object

  Rview$ = Worksheets("Sheet1").DropDowns("Report
List").List(Worksheets("Sheet1").DropDowns("Report List").Value)
  Dbase$ = Worksheets("Sheet1").DropDowns("Db
List").List(Worksheets("Sheet1").DropDowns("Db List").Value)
  Set session = CreateObject("Notes.NotesSession")
  Set db = session.GETDATABASE("AMMBNOTES", Dbase$)
  Set view = db.getView(Rview$)

  Set doc = view.GETFIRSTDOCUMENT
  r = 1
  On Error GoTo ErrRoutine
  While Not doc Is Nothing
    VC = doc.COLUMNVALUES
    c = 1
    For Each d In VC
      Worksheets("Sheet1").Cells(r, c).Value = d

    c = c + 1
  Next

  vr = r + 1
  Set doc = view.GETNEXTDOCUMENT(doc)
  Wend

  Set doc = Nothing
  Set view = Nothing
  Set view = Nothing
  Set db = Nothing
  Set session = Nothing

  Exit Sub

ErrRoutine:
If Err = 1005 Then Resume Next Else MsgBox Err

End Sub

Sub PopulateView()
  Dim session As Object
  Dim r As Integer
  Dim db As Object

  Dbase$ = Worksheets("Sheet1").DropDowns("Db
List").List(Worksheets("Sheet1").DropDowns("Db List").Value)
  Worksheets("Sheet1").DropDowns("Report List").RemoveAllItems
  Set session = CreateObject("Notes.NotesSession")
  Set db = session.GETDATABASE("AMMBNOTES", Dbase$)
    dbVIEW = db.VIEWS
    r = 1
    For Each view In dbVIEW
    Worksheets("Sheet1").DropDowns("Report List").AddItem (view.Name)
    r = r + 1
    Next

Set dbVIEW = Nothing
Set db = Nothing
Set session = Nothing

End Sub

Sub PopulateDB()
  Dim session As Object
  Dim dbdir As Object
  Dim db As Object

  Worksheets("Sheet1").DropDowns("Db List").RemoveAllItems
  Set session = CreateObject("Notes.NotesSession")
  Set dbdir = session.getDbDirectory("AMMBNOTES")
  Set db = dbdir.getFirstDatabase(1247)

  While Not db Is Nothing
  Worksheets("Sheet1").DropDowns("Db List").AddItem (db.filepath)
  Set db = dbdir.getNextDatabase
  Wend

  Set dbdir = Nothing
  Set session = Nothing
End Sub

This was first published in December 2000

Dig deeper on Domino Resources - Part 6

0 comments

Oldest 

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:

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchDataCenter

SearchExchange

SearchContentManagement

Close