Refresh view from action that modify column formulas

Hi all! I have a problem: I want to modify two view column formulas with a view action button that also has to refresh this view, to update column values to the new formulas. The action button modifies the column formulas, but view does not refresh … I have tried with “Call view.Refresh” and with “Dim ws As New NotesUIWorkspace Call ws.ViewRefresh” commands, but it doesn’t work … But when I open another view and then re-open the view, the column values are the right values … Here is the code:

Sub Click(Source As Button)

Dim session As New NotesSession

Dim db As NotesDatabase

Dim view As NotesView

Dim vc As NotesViewColumn



Set db = session.CurrentDatabase

Set view = db.GetView("vw_Visible_Questions")

If Not view Is Nothing Then

	Set vc = view.Columns(4)

	vc.Formula = "fld_QuestionCatala"

	Set vc = view.Columns(5)

	vc.Formula = {sValue1 := "A. " + fld_Answer1Catala;sValue2 := "B. " + fld_Answer2Catala;sValue3 := "C. " + fld_Answer3Catala;sValue4 := "D. " + fld_Answer4Catala;sValue1 : sValue2 : sValue3 : sValue4}		

	Call view.Refresh

End If

End Sub

Any help will be appreciated!!

Thank you for your time, Miguel.

Subject: Refresh view from action that modify column formulas

In the help notes I found this:

This view action refreshes the view that’s currently open.

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Call workspace.ViewRefresh

End Sub

So you may want to try this.

Thanks,

Jean

Subject: Refresh view from action that modify column formulas

I use similar code for the selection formula. This works with ViewRebuild method of the NotesUIWorkspace class. See my example. I hope it will help.

Sub Click(Source As Button)

Dim ws As New NotesUIWorkspace

Dim uiview As NotesUIView

Dim view As NotesView

Dim formula As String

formula = "SELECT Form = ""Machine Record"" & (@Adjust(W_End;0;-3;0;0;0;0) < @Today) & (W_End > @Today)"

Set uiview = ws.CurrentView

Set view = uiview.View

ShowExpired=False

view.SelectionFormula = formula

ws.ViewRebuild

End Sub

Subject: RE: Refresh view from action that modify column formulas

Many thanks George!! It worked perfectly!!!