LotusScript document references (basic)

I hope somebody knows something that can help me out here.

I’m in the process of building a CRM system in Notes 6.5, and I have one NSF which contains Regions (each Region contains a tex list of countries, taken from a profile document). In another database, when creating a Customer, the user must select a region. What I wat is for them to select a region name (which works already) and then have the UNID of that region placed into a field.

The only way I’ve managed to do this is with a double forall (pseudo-code):

forall entries in Regions field

forall regiondocs in a certain view

    if regiondocs.Name=entries then

        append the UNID to a field

    end if

end forall

end forall

This seems horrbly inefficient, and in fact takes a noticable amount of time to run when using lots of data. Is there an easier way to accomplish the same thing? Thanks!

Chris, the rookie in WAY over his head…

Subject: LotusScript document references (basic)

You don’t have to loop through all the regiondocs.I suppose you’ve got a picklist for the users to select a region from like

doccollection = ws.Picklistcollection(params)

There will be only one doc in this collection, so:

set regiondoc = doccollection.Getfirstdocument

customerdoc.yourfield = regiondoc.Universalid

HTH

Subject: RE: LotusScript document references (basic)

Patrick, you are my hero.

I didn’t know the PickListCollection method! Thankyou very much, this is an excellent solution to my problem!

Chris

Subject: LotusScript document references (basic)

I’m not sure I understand your problem right but here’s an idea…

I would split the Region/Country data into documents (not profile fields) and lookup views to be able to do lookups with GetDocumentByKey(KeyArray, true) where KeyArray could be “CountryName”, “RegionName”.

I could be way off though :wink: