Manage Learn to apply best practices and optimize your operations.

Bullet proof the PickListStrings method

This tip describes how to make the PickListStrings method more resiliant.

R5 introduced some new Methods in the NotesUIWorkspace class. One of them is the PickListStrings method. Basically it's the equivalent of the @PickList in @Formulas but in Script --- so now you can prompt your users without jumping through hoops like we had to in the past (i.e. a @Formula agent that prompted the users followed by another one in Script).

Unfortunately, the documentation provided for this method states that if the user clicks Cancel on the prompt, the variable will be equal to Nothing.

I tried to catch the error with a nothing but it didn't work. So I used the IsNull and IsEmpty functions to get the results I wanted. See the code below.

'Declare the variant needed to capture the results
Dim PickListResults As Variant

'Prompt the user ...
PickListResults = NUIWS.PickListStrings( PICKLIST_CUSTOM , True , ServerName, RefProdDB , "(ProductSearch)" , "Select the Product(s)", "Select the Product(s) to add." , 1 )

'Check to see if the user pressed Cancel
If Isnull (PickListResults) Or Isempty (PickListResults) Then
    Print "No products selected ..."
    Exit Sub
End If

'He didn't so add the products to the field ... note : the AnsellProductsField was declared prior to this and I didn't include all the code to keep this tip short.
For i = 0 To Ubound ( PickListResults ) Step 1
    Call ProductsField.AppendToTextList ( PickListResults(i) )
Next i

Dig Deeper on Lotus Notes Domino Administration Tools



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...