Lotus Script Help/Tips needed

Hi ppl, I have been using and developing in notes for a few years now, but I have only recently started to learn how to use the ‘script libraries’, but I am stuck.

I have a form [Profile] which has some info regarding a person and their holiday entitlements. Now, I wish to retrieve their remaining holiday via a Lotus Script from a different form [Request Holiday].

So far I have created a Function :-

Public Function DaysUsed (sProfileName As String) As String

Dim s As New NotesSession

Dim db As NotesDatabase

Dim doc As NotesDocument



Set db = s.CurrentDatabase



DaysUsed = doc.GetItemValue("ProfileVacationUsed") 

End Function

But my big problem is, how can I tell the function to look at a certain document and return the info required

Thanks

Dan

Subject: Lotus Script Help/Tips needed

Danny,

You could pass the Request Holiday document as a parameter

Function DaysUsed (sProfileName as string, RequestHolidayDoc as NotesDocument)

or do your lookup within your function

HTH

Mike

Subject: RE: Lotus Script Help/Tips needed

Subject: RE: Lotus Script Help/Tips needed

Cheers Mike, but if I pass ‘RequestHolidayDoc’ as NotesDocument how can retrieve the information from the form [Profile]?

I have a button in the Holiday Request Form and I need it to check the Holidays used from the Profile form based on the profile name.

Thanks

Dan

Subject: RE: Lotus Script Help/Tips needed

Danny,

I;m not quite sure what you are trying to achieve.

If you are passing the profilename already, then you can use that to get a handle on the profile document (don;t confuse forms with documents - forms are design elements - documents have the data on them)

Mike

Subject: RE: Lotus Script Help/Tips needed

Sorry I am not trying confuse you.

I have 2 Forms [Profiles & RequestHoliday]. I have created 1 Document in the Profiles Form, Fieldname ‘ProfileName’ and Document Data Stored JoeBloggs.

Now when I click on the RequestHoliday Form and select JoeBloggs from my list, I wish to call the LotusScript to lookup that Document and retreive the Info from the UsedHoliday Field

Subject: RE: Lotus Script Help/Tips needed

OK

To get to the profile document, you will need to set up a view sorted by the value you wish to search on (name)

Then, in your function, use NotesView.GetDocumentByKey to get a handle on the correct profile document

Subject: RE: Lotus Script Help/Tips needed

Thanks for all your help Mike.

I am getting different problem now