Showvariables Bug?

I have a “showvariables” bug to report. Has this been reported before?

Here are the last few lines of a lengthy procedure:

fg_showmacro = «Macro Text»
showvariables fg_showmacro
displaydata fg_showmacro, myformat
RTN

The displaydata command correctly shows the value of the variable, but a textDisplay object on a form DOES NOT UPDATE the variable. In trying to experiment why this might be, I did the following. I went to the TextDisplay object, confirmed that the “Formula” for the object was entered correctly (it was), deleted the last 3 characters, and re-entered them. That’s all. I just re-entered the same formula.

From that point on, the procedure works correctly.

There is obviously no way for me to replicate this situation, and I know what some of you will think (he must have mis-spelled the variable in the first place). But no, that variable was entered correctly, it worked correctly in other procedures of the same file, and was checked diligently.

If anyone else in future has an issue with showvariables not updating properly, try deleting the formula and re-enterring it in the textdisplay object. It may work for you as it did with me. Why that should work is a complete mystery. But it did.

Vic

You’re correct, that’s exactly what I think. Sorry. Or, I think in your experiments you did something else that you’re not remembering.

Under the hood, showvariables uses the same code used for displaying anything on a form, including fields from the database. If this code was unreliable in any way, it would have shown up years ago. This code is literally used thousands of times per day by any Panorama user that uses forms.

Can I ask you what motivated you to try this as a remedy? Why 3 characters rather than 2 or all 11 of them?


For future reference, if you are having issues with a formula in a graphics object, the Object Value dialog is super helpful. This is a new feature in 10.2.

No need to be sorry, Jim. That’s exactly what I would think in this situation.

The reason that I deleted only three characters was that I said to myself as I started the deletions - " This is crazy. The textdisplay object is giving me the correct value when other procedures in the same database execute. So it CAN’T be that the formula is typed incorrectly". So I stopped deleting, and added back the characters I had already deleted. I had intended to retype the entire formula.

But obviously I must have changed something else. What that was I have no idea. Just to further complicate the matter - when I was having the trouble, I noted that if I switched from “Data View” to Graphics View", and then back to “Data View”, the object updated itself. That’s another reason I figured it couldn’t be a mis-spelled variable in the formula tab.

The database is working now, so there is no remaining issue. I’ll just chalk this up to another of the grand mysteries of life, and move on. The fact that no one else has experience this is further proof that it is my error to blame. I’m sorry to have taken up your time.

Vic

Are you sure the form was in Data View when you ran the procedure? Form objects don’t update when in Graphics View. This includes showvariables. You have to make sure that the form is in Data View before you run any procedure that modifies the data displayed on the form.

then back to “Data View”, the object updated itself.

When you switch back to Data View, Panorama updates ALL objects on the form.

It does sound like you had the formula spelled correctly. Now it seems most likely to me that the form was in Graphics Mode when you ran your procedure with the showvariables statement.

So @admin I note your comments about Showvariables being super-road-tested, so would welcome understanding why it’s not working for me. This was true in Panorama 6 and is also true in Panorama X in the same file that’s been imported.

The files initialize procedure is as follows:

fileglobal Subset_1,Subset_2,Source_1,Source_2,Import_formula_1,Import_formula_2

Subset_1=array(Subset,1,“|”)
Subset_2=array(Subset,2,“|”)
Source_1=array(Source,1,“|”)
Source_2=array(Source,2,“|”)
Import_formula_1=array(«Import formula»,1,“|”)
Import_formula_2=array(«Import formula»,2,“|”)

openform “Input”
call .CurrentRecord

The .CurrentRecord procedure is as follows:

Subset_1=array(Subset,1,“|”)
Subset_2=array(Subset,2,“|”)
Source_1=array(Source,1,“|”)
Source_2=array(Source,2,“|”)
Import_formula_1=array(«Import formula»,1,“|”)
Import_formula_2=array(«Import formula»,2,“|”)

showvariables Subset_1,Subset_2,Source_1,Source_2,Import_formula_1,Import_formula_2

The form in question (Input) has a Text Editor Superobject for each variable. But these do not display.

Screenshot 2024-02-14 at 17.22.41

If, however, I enter graphics mode, delete the yellow background, and undo: now they display.

Screenshot 2024-02-14 at 17.24.48

Is there a way I can just force them to display without the “dance of the seven veils”.

You might try adding a magicformwindow statement before the showvariables code to see if that forces an update of the form.

magicformwindow "","Input"
showvariables Subset_1,Subset_2,Source_1,Source_2,Import_formula_1,Import_formula_2
magicwindow ""

If by "Files initialize procedure, you are referring to variables setup with ShowVariables in the .Initialize routine know that, amazing but true, the .Initialize isn’t the first thing that happens when PanX opens a database. So it could be a timing issue.

I don’t recall the exact warning - would have to look back in previous posts - but I believe Jim cautioned against placing some Form related activity there.

In fact, he went out of his way - thank you Jim - to add a form opening feature: File/Database Options/General Tab/Initial Window.

Maybe this is some kind of timing issue. If you do the ShowVariables in a separate procedure (just for testing) after the form is open, do they update? If so, then there is probably a timing complexity with the .Initialize procedure - if that’s the procedure you’re referring to.

Check the form properties, and make sure you have Variables set to FileGlobal.

If you have it set to Global instead, and your Input form is already the initial window, then it will automatically create global variables with those names before the .Initialize procedure runs. It will be those global variables that the text editor will be attempting to display, but it will be the
fileglobals, that your .Initialize declared, that will contain the values.

Your “dance of the seven veils” is causing the objects on that form to once again go looking to see if the variables they can set already exist, or need to be created. This time, they discover the FileGlobals with that name.

Thanks a million Dave, you appear to have nailed it. Yes, I had Global not FileGlobal variables selected and switching that appears to have fixed the issue.

Thanks also designer and Gary for your comments. I wasn’t aware of Initial Window and will look out for it and also keep the magic window option in mind. It appears I still have much to learn as I rather belatedly start the migration from 6 to X…

You don’t say, but am I correct in assuming that Subset, Source and Import Formula are field names?

I think it is possible for your application to be MUCH simpler.

First of all, is there a reason why you are using Text Editor objects? If you used Text Display objects, you could dispense with the fileglobal variables, and with all of the code you have written. Just put the formulas directly into the Text Display objects. You won’t need any .Initialize code, and you won’t need any .CurrentRecord code. The Text Display objects will automatically update as you move from record to record. No variables to initialize, and no code to write or debug.

Perhaps you want to be able to copy the text from these objects to the clipboard. In Panorama X, you can enable copying from a Text Display object with a single checkbox (Allow Text Selection). Easy peasy.

If you DO actually need to edit the text thru this form, you can do that as well. All you need to do is use the Formula mode instead of linking the text editor to a field or variable.

If you are allowing editing, you will need some code that is used to write the modified text back into the appropriate field. This is described in the documentation.