I have a Text Display Object that is set to Formula Mode and contains the following formula: "Version: " + «fgVersion». The object is updated with a procedure that updates the FileGlobal variable, fgVersion, with a date in text format. Sometimes the procedure updates without any problem, and other times it refused to update. Yes, I am using a ShowVariables statement at the end of the update procedure. When the last statement in the procedure is Message fgVersion, the message displays correctly, but the TDO will or will not update depending on the weather or the mood trending that day. I apologize for the sarcasm. I know I am probably doing something wrong that no one else would ever consider. I can ultimately get the object to update by going into Design Mode, clicking on the formula inside the object, and then back out of Design Mode.
With such limited information, I’ll have to guess. The showvariables statement only works for windows associated with the currently active database. If some other database is active (for example if you are using a “secret” window), the Text Display object will not update.
Strangely, at this moment I have a file that has a Text Display Object that does not work. The formula is: "Version: " + «fgVersion». I can run code that will change the value of fgVersrion, but the TDO does not update. Here is an example of code used to update the TDO for testing:
Local K, N
N = Info(“DatabaseName”)
fgVersion = “”
If fgVersion = “”
K = “Hello World”
K = "Version: " + fgVersion
Message info(“databasename”) + cr() + K
Going in and back out of Design Mode has no affect. However, if I go into design mode, click anywhere within the TDO formula pane, and then exit Design Mode, the TDO will update as it should. Unfortunately, I have not been able replicate or re-create at will the problem where the TDO will not update. It seems to happen quite randomly, and I am now watching more diligently to see what might cause it to fail. I have been experimenting with chevrons around the variable, but that does not seem to have any affect.
James, I made a little test DB following your recipe with one exception: I included the definition of the fileglobal variable into the test procedure. As you can see, there is all working as expected:
So I am wondering what else is causing this issue for you. Is this Text Display object perhaps on a Header tile of a View-as-List form?
Today I circled back to work on this problem with a Text Display Object that does not refresh consistently. I discovered that the original value of the object is programmed to display the results of a lookup( executed inside an .initialize procedure. That is likely the source of the problem. By the way, the actual lookup( does not give a correct result when executed inside the .initialize program only on the first execution of the .initialize procedure when the file is open. Repeating executions of .initialize does give the correct result from the imbedded lookup(. Consequently, I will change my code to simplify the .initialize procedure and use a different method to get the results that I want. For what it is worth, the lookup( not only gives me the wrong value, but the Text Display Object intended to display the value seems to enter a frozen state and cannot respond to value changes in its display formula followed by a show variables statement. However, going into design mode, clicking anywhere inside the formula pane of the TDO, and then going back out of design mode unfreezes the TDO allowing its formula to properly display results.
This is just a shot in the dark, without seeing the formula, but if the variable in question is inside a quoted parameter, ShowVariables isn’t going to recognize it as a variable. If that’s the problem, you may need to include an ignore( function containing the variable as the ignored parameter, just so ShowVariables will see it.
The variable is not inside a quoted parameter. I think the problem has something to do with the lookup( inside the .initialize procedure. It could be a timing issue. I am not sure, however, because I am initializing a couple dozen file global variables in addition to the suspect file global variable, which is assigned the result of the lookup(. The lookup( only fails when the file is first opened. After that the lookup( seems to work as expected. The TDO appears to go into a frozen state on that failure. However, if I unfreeze the TDO via the method described above, the TDO works beautifully all day long, until I quit and open the file again.
Like Dave, I’ll offer a shot in the dark. Give this a try right after the lookup:
Thanks for the suggestions. Jim, that didn’t work. Error message says REDRAW is not supported by the TDO:
Since that first lookup is apparently the only time it fails, and it’s in your Initialize procedure, either things aren’t ready to perform a lookup or something is subsequently negating it.
Is the file the lookup is directed to open and initialized? Can the lookup be moved to a later spot in the Initialize? Have you embedded a zlog right after the lookup to see if it’s actually getting the right value but failing to display it? Have you applied a ShowVariables to its contents?
BTW, your March 10 post has fgVersion being emptied before being evaluated. So I don’t see what the value in that one is. K should always result in “Hello World”.