Creating a readers/authors field in LotusScript

Hi All,

I am attempting to create readers/authors fields on a backend document using lotusscript.

I have managed to create the field using the following…

Dim newr1 As New NotesItem(curdoc, “Readers”, ReaderList, READERS)

This codes runs from within a sub held in Script Library. The sub receives two parameters

  1. The list of names for values of the Readers/Author field

  2. A Value of “authors” or “readers” to determine the type of field to create.

I need for the code above to receive use the second parameter to determine the type of field to create.

My attempt of this was as follows

Dim newr1 As New NotesItem(curdoc, ReaderOrAuthor, ListOfNames, ReaderOrAuthor)

It seems I can use the Parameter of the sub for the 2nd parameter of of the new noteitem, however I am unable to use it for the last parameter of the declaration as it is a Constant and I am using a string.

Is there a way to use the String Parameter (ReaderOrAuthor) that passed to the Sub as the Constant Parameter of New notesItem??

I am hoping that this makes sense and that somebody is able to help me resolve this issue.

Regards,

Andrew

Subject: The 4th parameter is a constant

In this line,

Dim newr1 As New NotesItem(curdoc, “Readers”, ReaderList, READERS)

The second parameter isn’t the same as the fourth.

“Readers” is not READERS.

READERS is a constant !

This is why this :

Dim newr1 As New NotesItem(curdoc, ReaderOrAuthor, ListOfNames, ReaderOrAuthor)

doesn’t work.

Hope this helps

Renaud

Subject: I did state that it was a constant in my original post

I did state that it was a constant in my original post. I was aware of the reasons that it does not currently work.

My question was…Is there any way to use the string parameter as for that Parameter by an in-built LotusScript Method?

Thanks

Subject: Use a variable with an select case statement

Semothing like :

Dim fieldType As Integer

Select Case ReaderOrAuthor

Case “Readers” :

fieldType = READERS

Case “Authors” :

fieldType = AUTHORS

Case Else :

’ just there to handle wrong parameters

Msgbox “unknown type”

end

End Select

Dim newr1 As New NotesItem(curdoc, ReaderOrAuthor, ListOfNames, fieldType )

Renaud

Subject: Thats great - works a treat!

Thanks for your time and help