2nd to lat q, how to Automatically Update view

Hi, I am using the useful new function with notes.view, being able to be a bit more dynamic with notes view, e.g. can set on basis of a prompt!

This is now working, thanks to some help from people on this forum! Hooray!

Except…

Except, it doesn’t refresh the view automatically.

I have a button which is to do this inside the view, button code is at the end of this post.

So far so good. However, you have to physically click off the view onto another view, and then go back to this view, for the code to be honoured, even tho I gave it a refresh…

How come? Is it possible to make it update straight away, e.g. once the user has selected the status they are interested in, it will display all the documents with that status - (or all the documents if they select all!).

Here’s the code:

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uiview As NotesUIView

Dim view As NotesView



Dim response As Variant

'Dim values As Variant

Values1=Evaluate(|@DbLookup("Notes":"NoCache" ; ""; "Keywords"; "Status"; 2):"All"|)

'Dim values2 As Variant

Values2=Evaluate(|@DbLookup("Notes":"NoCache" ; ""; "Keywords"; "All"; 2)|)



values = Values1

response = ws.Prompt (PROMPT_OKCANCELLIST, _

"Select a Status", _

"Please select the status's you would like in the view.", _

values(0), values)



Dim formula As String

If response<>"All" Then

	formula = {SELECT form = "Issue" & Status ="} + response + {"}

Else

	If response="All" Then

		formula = {SELECT form = "Issue"}

	End If

End If

Set uiview = ws.CurrentView

Set view = uiview.View

view.SelectionFormula = formula

View.AutoUpdate = True 

Call view.Refresh

End Sub

Thanks for all responses…

Eventually, maybe…we could once they have finished, reset it to a default status showing all documents?!

Subject: 2nd to lat q, how to Automatically Update view

Generic,

You need to rebuild, not refresh, a view after its design has been changed.

regards,

raphael

Subject: RE: 2nd to lat q, how to Automatically Update view

Thanks Rapheal,Another result for the LN Forum. Execellent.

For the benefit of people who may search here is the code:

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uiview As NotesUIView

Dim view As NotesView

Dim response As Variant

'Dim values As Variant

Values1=Evaluate(|@DbLookup(“Notes”:“NoCache” ; “”; “Keywords”; “Status”; 2):“All”|)

'Dim values2 As Variant

Values2=Evaluate(|@DbLookup(“Notes”:“NoCache” ; “”; “Keywords”; “All”; 2)|)

values = Values1

response = ws.Prompt (PROMPT_OKCANCELLIST, _

“Select a Status”, _

“Please select the status’s you would like in the view.”, _

values(0), values)

Dim formula As String

If response<>“All” Then

formula = {SELECT form = “Issue” & Status =“} + response + {”}

Else

If response=“All” Then

formula = {SELECT form = “Issue”}

End If

End If

Set uiview = ws.CurrentView

Set view = uiview.View

view.SelectionFormula = formula

'View.AutoUpdate = True

Call view.Refresh

Call ws.ViewRebuild

End Sub