Choose date and change value on multiple documents in a view

I have a date field in a form that users are able to change many documents with an agent that calls a DLL (ndbform1.dll if anyone is familiar with it) that brought up a dialog box with a calendar. By selecting a date and hitting OK, the new date would be populated in the aforementioned field.

It worked fine with releases 4.x and 5.x, but a few users have been upgraded to 6.5.4 and the agent no longer works. The calendar dialog box is not displayed at all.

If someone can help me fix it or point me in the direction of an easy alternative, that would be greatly appreciated.

Here is my code for the agent, which works in an action button as well (which calls another agent for populating the field):

result := @DbCommand(“Form1”:“NoCache”;“Calendar”;“Choose new call back date”;@Today;“T”);

ENVIRONMENT ENVresult:=@Text(result);

@If(ENVresult = “Current transaction aborted”; @Return(DateCallBack); (@Command([ToolsRunMacro]; “(HIDDEN Change call back date)”)));

@All

Here’s the 2nd “hidden” agent:

FIELD DateCallBack := DateCallBack;

result := @TextToTime(@Environment(“ENVresult”));

@SetField(“DateCallBack”;result);

SELECT @All

FYI: the environment variable in the notes.ini for ENVresult is stored as:

$ENVresult=The necessary external database driver cannot be located

If you have some ideas and need more information, let me know and I’ll reply quickly.

Subject: Choose date and change value on multiple documents in a view

If all you want to do is display a calendar view, pick a date and write a bunch of documents I’m not clear on what you need an external dll for. You can do all that with notesuiworkspace.pickliststrings and notesdatabase.unprocesseddocuments. Of course you will need to have documents to select in the calendar view - maybe that’s what the dll does, give you a real calendar control. (But so does a Notes form, so you could use notesuiworkspace.dialogbox instead.) Either approach also lets you leave the notes.ini alone.

Subject: RE: Choose date and change value on multiple documents in a view

Thanks for the input. I guess one of my problems lies in the fact that I don’t know LotusScript.

The other thing is that I’m not using a Calendar view; I’m just looking at a standard document view and trying to change a date field on many documents at the same time, but with a graphical dialog box calendar. I’ll do some more research on my own, but if anyone can show me some sample code that I might be able to use, I’d appreciate it.

Thanks again.

Subject: RE: Choose date and change value on multiple documents in a view

While rewriting the solution is generally a bad option, at other times starting over is healthy, and I think this is such a case.

Suppose the user selects three documents in the view and wants to change the date value in each to new date x. You obtain the documents the user has selected by using notesdatabase.unprocesseddocuments. An action button to do that would be appr as follows:

dim s as notessession

dim db as notesdatabase

dim dc as notesdocumentcollection

set s = new notessession

set db = s.currentdatabase

set dc = db.unprocesseddocuments

if dc.count > 0 then

’ do something

end if

If the user has not selected any documents unprocesseddocuments returns the document the user is standing on.

Now you want to get date value x.

The absolute simplest way to do that is to ask the user to type it in using Inputbox$:

dim s as notessession

dim db as notesdatabase

dim dc as notesdocumentcollection

dim tmp as string

set s = new notessession

set db = s.currentdatabase

set dc = db.unprocesseddocuments

if dc.count > 0 then

tmp = inputbox$(“title”,“type a date value”,cstr(Today))

if tmp = “” then exit sub

if not isdate(tmp) then msgbox “That’s not a date, sorry”:exit sub

set doc = dc.getfirstdocument

do while not doc is nothing

call doc.replaceitemvalue(“TheDateField”,cdat(tmp))

call doc.save(false,false)

set doc = dc.getnextdocument(doc)

loop

end if

I haven’t tested this so there could be syntax errors etc.

You could prettify this by using a Calendar control in a Notes form and present the form to the user by notesuiworkspace.dialogbox. For an example of dialogbox see here .

Subject: RE: Choose date and change value on multiple documents in a view

Thanks again, Thomas.

I took what you wrote and added a few things:

Sub Click(Source As Button)

Dim s As notessession

Dim db As notesdatabase

Dim dc As notesdocumentcollection

Dim tmp As String

Dim workspace As New NotesUIWorkspace

Dim view As NotesUIView



Set s = New notessession

Set db = s.currentdatabase

Set dc = db.unprocesseddocuments



If dc.count > 0 Then

	tmp = Inputbox$("Please type the new date in the format MM/DD/YYYY.","Change Scheduled Call Back Date",Cstr(Today))

	If tmp = "" Then Exit Sub

	If Not Isdate(tmp) Then Msgbox "Sorry, but that date format is not acceptable.  Please try again":Exit Sub

	Set doc = dc.getfirstdocument

	Do While Not doc Is Nothing

		Call doc.replaceitemvalue("DateCallBack",Cdat(tmp))

		Call doc.save(False,False)

		Set doc = dc.getnextdocument(doc)

		Call workspace.ViewRefresh

	Loop

	Set view = workspace.CurrentView

End If

Call view.DeselectAll	

End Sub

I’m going to keep trying and see if I can get it to work with a calendar control.

Subject: RE: Choose date and change value on multiple documents in a view

You’re working way too hard. I suggest you use the nifty calendar control which is built into Notes.

Subject: Choose date and change value on multiple documents in a view

The issue is related to the re-writing of the formula engine. The Formula One Toolkit requires the an R4/R5 DLL, NNIF.DLL. R6 does not have this DLL anymore as it became obsolete with R5, however, IBM/Lotus still packaged it in an install for compatibility for R5 installations. To get it working in R6, drop the NNIF.DLL along with the ndbform1.dll. Our company testing has shown having this DLL on R6 workstations does not pose any incompatibility issues.

John