Forcing Update of Text Display

I’m having trouble getting text displays to update. I have looked at the examples discussed here and in the help files and none seem to give me the clue I need.

On a form that opens with the initial database I have a text display with info(“globalVariables”) as the formula. It shows what look like Pan’s native set of items. Immediately after, I set some new global variables and assign values to them. No matter what I do, short of closing the window and re-opening it, I can’t get the list to update. Other forms that I pop open have the full list. Is there a show command or objectaction that would do this like a “redraw” command for a matrix?

Thanks in advance,
Scott

The ignore( function can be useful for this.

ignore(info("globalvariables"),update)

When you want to get the text display to update, you would just use

showvariables update

You need not have a variable named update, nor do you have to use the name update. The show variables command will see that there is apparently a variable named update in the formula, and it will force a reevaluation of the formula. The ignore( function will simply ignore its second parameter, so it won’t matter if there really is a variable by that name or not.

Here’s another way to do this:

info("globalvariables")+catcherror("",update)

Then just like in Dave’s example, to update run this.

showvariables update

Just make sure you don’t ever create a variable named update. I usually use a less generic variable name to avoid that possibility, for example in this case I might use gvupdate.

Some of you may be wondering why this trick is necessary. Changing the display is an expensive (i.e. slow) operation. It needs to be minimized to keep Panorama as fast as possible.

When you run the showvariables statement, Panorama scans every object in every open form window to see if the object formula contains that variable. If forms contain a lot of objects, that becomes a fairly complicated slow operation. That’s why this isn’t done every time a variable value changes. Instead, it is only done “on command” when showvariables statement runs.

In order for your example to work without any extra trick, Panorama would have to check all form objects looking for the info(“globalvariables”) function every time a global variable was added or removed. That would be super slow! And thats just one info( function, there are nearly a hundred. And there are hundreds of other functions you might put in formulas that would need the same logic. This would be insanely complicated, would slow down all Panorama code considerably, and for a quite rare situation.

Since this is a rare situation, no specific feature was added to Panorama to handle it. Instead, you just put in a fake variable, and use the standard showvariables statement to trick Panorama into displaying whatever you want. Dave and my solutions are just two different ways to include a fake variable in Panorama X. (This same trick used to work in Panorama 6, but you had to set up a real variable with empty text in it. You can still do that, but it’s an extra step. Though it makes the formula simpler, you don’t have to use ignore( or catcherror( if you actually set up a variable with empty text.)

The reason I like the ignore( version is that it doesn’t matter if the variable exists or not. If the variable doesn’t exist, the second parameter is an error value, which is ignored. If the variable does exist, the second parameter has the value of that variable, and that gets ignored.

I can’t argue with your logic. I’ll try to get into the habit of using ignore( in the future.

Thanks for the help with this. Both Jim’s and Dave’s method worked in my testing.

In case anyone else is reading this, the statement: ignore(info(“globalvariables”),update) goes in the formula property of the Text Display element, and the showvariables update statement goes in the procedure doing the updating.

On to the next learning experience…

I have the same problem as ScottC described. I tried to follow the advice offered by entering “ignore(info(“global variables”),update” into my procedure, but I get an error message:
Unknown statement: ignore(info(

What am I missing?

This scheme is to be used with a Text Display that has a formula without a variable or field in it. In the example that started this topic the formula in the Text Display was simply info(“globalVariables”) which had no variable or field name within it. If, however, you have a formula containing a variable all you need to do to update the Text Display is use showvariables yourVariable in the procedure (if it is a field name you would use showfields instead).

On the other hand, without a variable or field name in the formula, you need to trick the Text Editor to force an update. The suggested solution is to surround your existing formula with the ignore( function as shown with ignore(info("globalvariables"),update). This of course is only for the formula used in the example. You would do this in the Formula pane of the Text Editor and not in the procedure. Your procedure would need the line showvariables update to actually force the Text Display update.

That formula goes into the Text Display object, not into the procedure.

Thanks. I’ll give it a try.

Rabe,

You are missing a closing parenthesis.

“ignore(info(“global variables”),update”

should be

“ignore(info(“global variables”),update)”

Regards,

Eric

Thanks, Eric.

Rabe, I am quite sure this is an autocorrect error, caused by the forum software, but to be correct, this code line must read

ignore(info("globalvariables"),update)

A space character in the info( function would prevent Panorama X from recognising the function.

I find this procedure works in your form window:

closewindow
openform “name of your form”

Another window must be active for this to work