I have a question, and I am sure it is pretty basic, but it has been giving me a lot of trouble.
I have a form (Lotus Notes 7.0.1) that is using several hide/when statements based on hidden field values. I have a button that calls a LotusScript function, and the function updates the hidden field which should trip the hide/when logic. Before the sub ends, I call RefreshHideFormulas. The problem is that my fields don’t hide when I first press the button, but the field value does change. What am I missing?
I tried a Refresh prior to the RefreshHideFormulas, but I get the “@Commands and other UI functions are not allowed in this context.” message.
Public Sub ShowAll(tbRefreshHideFormulas As Boolean)
Dim ws As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Set uidoc = ws.CurrentDocument
'Storing the show and hide switches in fields
Call uidoc.FieldSetText("HideISFields","False")
Call uidoc.FieldSetText("HideFacilitiesFields","False")
Call uidoc.FieldSetText("HideFiscalFields","False")
Call uidoc.FieldSetText("HideAdminFields","False")
Call uidoc.FieldSetText("HideHRFields","False")
If tbRefreshHideFormulas Then
Call uidoc.RefreshHideFormulas
End If
Forgive me for suggesting the obvious, but I see your call to RefreshHideFormulas is in a conditional. Are you sure tbRefreshHideFormulas is True at that point?
Generally speaking, if FieldSetText doesn’t give you an error, I don’t see why Refresh should. Perhaps this error is coming from a formula which is executed as part of the refresh, e.g. in a computed field formula. But you should not need to refresh for this to work. Do you get the same message if you press F9?
What is one of the hide formulas that doesn’t work? Does it work if you press F9?
The RefreshHideFormulas is getting executed, and I understand the need to check the obvious! More than likely I am missing something obvious.
I do not get an error messages when I press F9, and appears to have no effect on the form. The fields I want to hide/show do not hide/show. For testing purposes, I placed a button on the form that only does a RefreshHideFormulas, and when I click button after executing the code in the previous post, my fields hide/show correctly.
I may not have explained the problem very well in my previous post. The first time I execute the “showall” code, my hidden fields stay hidden, but the field values I set have changed. If I execute this button again it will work, but it is always a step behind.
Here is one of the Hide formulas: HideISFields=“True”. This references a text field whose value is set in the sub from the first post. I toggle the values betweei True and False.
No, the hide does not work when I manually change the value and press F9. It does work if I click the RefreshHideFormulas button I added for testing. Thanks.
I had the same problem and I was able to resolve it by duplicating each uidoc.FieldSetText with uidoc.Document.ReplaceItemValue. It is not very nice, but it works.
I had to leave a response as I’ve encountered the same problem and I’m wondering if it is a bug.FYI - I’m on version 6.5
I’ve got a command button and in LS I called a Prompt from the workspace and then set Field A with text. I then called the uidoc.RefreshHideFormulas. Field B has a hide/when formula that basically says if FieldA is Null then Hide otherwise display.
I really believe that the RefreshHideFormulas in LS does not work. I rewrote the code in formula and did the equivelant of the LS with @Command([RefreshHideFormulas]) and it worked. I was lucky that I only had a simple function and Formula language would suffice.