Manage Learn to apply best practices and optimize your operations.

Allow a Dynamic Keyword Lookup

Formula/Agent:
This code/agent will essentially allow a dynamic keyword lookup that will either use an existing selection or you can create a new selection that will add itself to a maintenance view so that it is there next time. i.e. If you have a dialog box that allows vallues not on list, then you can type the option in, but you will have to type it in each time, with this code you can allow values not on list, but at the same time they are in a maintenance view...


'<Begin code>'

 

lookup := @DbColumn("":"nocache";"";"(status)";2);

 

error_check := @If(@IsError(lookup);"";@Unique(lookup));

 

prompt := @Prompt([OKCANCELLIST];"Status Code";"Please select a status code for this inventory item...";"<New Status Code>";@Unique(@If(error_check = "";"<New Status Code>";"<New Status Code>":error_check)));

 

value := @If(prompt = "<New Status Code>";@Prompt([OKCANCELEDIT];"Enter New Code";"Please enter the new status code...";"");prompt);

 

FIELD status := value; @Environment("category";"Status");
@Environment("key";value); @If(prompt != "<New Status Code>" ; "" ;
@PostedCommand([ToolsRunMacro]; "(keywordmaint)"))

 

Then this is the code for the "(keywordmaint)" agent...

 

Sub Initialize Dim ws As New notesuiworkspace
Dim uidoc As notesuidocument
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Dim key As String
Dim doc2 As notesdocument

 

Set db = session.currentdatabase
Set uidoc = ws.currentdocument
Set doc = uidoc.document
Call doc.save(True,True)
Set doc2 = New notesdocument(db)
'"dbmaint" is the maintenance document... doc2.form = "dbmaint"

 

key = session.getenvironmentstring("$key",True)
cat = session.getenvironmentstring("$category",True)
doc2.keyword = key doc2.category = cat Call doc2.save(True,True)
End Sub

 

'<end code>'

Dig Deeper on Domino Resources - Part 2

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchWindowsServer

Search400

  • iSeries tutorials

    Search400.com'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 ...

SearchDataCenter

SearchContentManagement

Close