Avatar of maximjon
maximjon
 asked on

Problems opening folders that I automatically created via Lotus Script...

Hello Everyone,

I need to be able to give users the flexibility to create their own reports in a Lotus Notes database.  Maybe there's an easier way and I might be taking the wrong approach to the design of this database, but I essentially created a form that will manipulate the Notes full text search functions.

Right now the form only has three fields: a text field for the Report Title and two date fields (Start and End).

After the user clicks the 'create report' button, the code I specified below executes.

The program gathers all documents that fall within the date range the user specifies and then dumps them in a folder that is created with the title of whatever the user typed into the 'Report Title' field.

Now the problem I'm having is actually opening up that new folder that was just created.  I put the line: Call ws.CurrentDatabase.OpenView(ReportTitle)   at the end of the code but I get the error message: "View or Navigator '[folder name]' does not exist.  The folder does however exist.  If I close out and come back in I see that it was created by the code.

Is there some other way I should be doing this?  or is my concept of creating a 'reporting form' just poor design all together?

All suggestion appreciated.  Thanks,


Sub Click(Source As Button)
	Dim ws As New NotesUIWorkspace
	Dim s As New NotesSession
	Dim db As NotesDatabase
	Dim vw As NotesView
	Dim doc As NotesDocument
	Dim uidoc As NotesUIDocument
	Dim j As Long
	Dim count As Integer
	
	Set db = s.CurrentDatabase
	Set vw = db.GetView("Main")
	Set uidoc = ws.CurrentDocument
	
	ReportTitle = uidoc.FieldGetText("rptTitle")
 
	Call db.UpdateFTIndex(True)
	
	strSearch = "[dataEndTS] >= " & uidoc.FieldGetText("rptStartDate") & " And [dataEndTS] <= " & uidoc.FieldGetText("rptEndDate")
	j = vw.FTSearch(strSearch, 0)
	
	count = 0
	
	Set doc = vw.GetFirstDocument
	While Not(doc Is Nothing)
		Call doc.PutInFolder(ReportTitle, True )
		Set doc = vw.GetNextDocument(doc)
		count = count + 1
		Print count
	Wend
	Call vw.Clear
	
	Messagebox "Report is complete"
	
	Call ws.CurrentDatabase.OpenView(ReportTitle)
End Sub

Open in new window

Lotus IBM

Avatar of undefined
Last Comment
maximjon

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Bill-Hanson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Sjef Bosman

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
maximjon

ASKER
Good suggestion sjef.
I tried adding the following code (listed below) to close the form and reopen the database to the newly created folder.  It actually worked initally when I tried it on my computer.  It didn't work exactly how I wanted it to since it keeps the initial window open in the background and opens another instance on top but hey, I can't complain about that.
The strange thing about this work around is that I can't get it to work on every pc/user that's been testing this for me.  Some people still get the same error as before while others don't.  I thought this might be a caching issue but I watched as the debugger runs through the new code and it is present.  (sigh) gotta love Notes.

	Call ws.CurrentDocument.Close
	
	Call ws.OpenDatabase("[server]","[database]")
	
	Call ws.CurrentDatabase.OpenView(ReportTitle,"",False,True)

Open in new window

maximjon

ASKER
Bill,
I'm actually curious to know how you're pushing the search string to the users search bar using Win32 API.  Do you have any examples you would be willing to divulge?  Thanks
SOLUTION
Bill-Hanson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
maximjon

ASKER
I Eventually re-developed my solution in .NET using SQL Server Reporting Tools.  I've learned that Notes really isn't a good tool for selective reporting and printing.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes