0
votes

In a view I have created a checkbox action button. The action button shows/hides the checkbox based on the formula I have set:

@If( AAAR = True; @True; @False )

I declared the variable AAAR under the view's declaration section like this:

Dim AAAR As Boolean

Now this flag is set in the OnSelect event so that whenever users clicks/selects a document from the view, this event triggers:

Sub Onselect(Source As Notesuiview)

Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim uiview As NotesUIView
Dim doc As NotesDocument

Set db = session.CurrentDatabase  
Set uiview = ws.CurrentView         
Set doc = db.GetDocumentByID(uiview.CaretNoteID)

If doc.GetItemValue("AllotmentApprovalReq")(0) = "Yes"  Then
    AAAR = True
Else
    AAAR = False
End If

End Sub

Now the problem is that, i want the checkbox menu should change its status (checkbox / no checkbox) based on this value AAAR. I have to do 'something' in the OnSelect event but i don't know how to access and set the checkbox menu from there. Please help.

1

1 Answers

1
votes

Wow, this is a total mess: First of all: @Formulas variables and LotusScript- Variables have nothing to do with each other. In @Formula whenever you write a variable name it is always one of the following two:

  • An item with that name in the document that is currently in focus (an open document or the document under the cursor in a view). Beware: Actions are NOT automatically recalulated when you select another document, you need to enable the action bar properties of the view to update on focus change
  • A variable from earlier in the same formula

If your example is right, then the formula in your action button would simply be:
@If( AllotmentApprovalReq = "Yes"; @True; @False )

No need of any code in Onselect at all...

But again: You need to set the view action bar to recalculate on every focus change.