UIDoc.Refresh not displaying items correctly

Scenario: I’ve got a loading animation (an animated gif) in a line that is controlled by a hide-when formula. The hide-when formula is dependent upon a field set via LotusScript – when the field has text in it, the animated gif isn’t shown, but if the field contains just “”, the animated gif is shown.

The code to display the gif is simple (or at least it should be):

Call UIDoc.FieldSetText(“ReportOutput”, “”)

Call UIDoc.Refresh

As you can see, whenever the field “ReportOutput” is set to the “” string, the document should be refreshed and the gif should be shown. Later on in the script I have:

Call UIDoc.FieldSetText(“ReportOutput”, outputText)

Call UIDoc.Refresh

which should run the hide-when formula again and hide the animated gif.

Problem is, it doesn’t work! While the other LotusScript is running between these two bits of code (it’s some simple script performing a search on the database), the animated gif isn’t shown. The output field is blanked out, but the gif just doesn’t show up.

Oddly enough, if I exit the script right after the first refresh (via “Exit Sub”) the gif appears!

I wonder – do two “UIDoc.Refresh” commands placed in the same execution of LotusScript not really make a difference? Are you limited to one “UIDoc.Refresh” per block of code?

Subject: UIDoc.Refresh not displaying items correctly

You need to save hte doc in order for the new field values to stick.When you refresh you call the uidoc.document values to the fields.

Try this:

Call UIDoc.FieldSetText(“ReportOutput”, “”)

Call UIDoc.save

Call UIDoc.Refresh

Shawn

Subject: RE: UIDoc.Refresh not displaying items correctly

well, here’s the catch – the form is actually one that i’m accessing via a @DialogBox formula command just to do momentary computations and display a couple of things in… I’d never actually want the document to be saved, otherwise this solution would be perfect… Is there another command to make the refresh “stick?”

Subject: RE: UIDoc.Refresh not displaying items correctly

Have you tried using NotesUIDocument.RefreshHideFormulas instead?

Subject: RE: UIDoc.Refresh not displaying items correctly

aye – tried it before, same result. I was really rooting for “RefreshHideFormulas” to work, too…

hey, i know you – i read your blog. jeez, it’s a small world.

Subject: RE: UIDoc.Refresh not displaying items correctly

Can you do a save then delete?

Shawn

Subject: RE: UIDoc.Refresh not displaying items correctly

While that would probably work, I’ve since stopped trying – this is way too much effort for an animated gif. :stuck_out_tongue: I’ve just gone with a bit of “Loading…” text that’ll show in the output field before it’s populated. That combined with the fact that the cursor changes to the hourglass during the computation faze of the code should be enough for the user to know that something’s going on! (Placating the user during times of possibly long computation is a pet peeve of mine.)

Subject: RE: UIDoc.Refresh not displaying items correctly

Don’t give up!!

The devil is in the details!!

GL

Shawn