Global variable do not work


#1

Hi,
I create a global variable called gMENU in one database, but it is not recognized in an other database. It seems the global variable do not work.
Could anybody help me ? Thank you !


#2

I don’t use global variables very often, but I just tried it, and it worked for me.

We are going to need more specific information. How did you declare it? What initial value did you give it? What were you trying to do with it when it failed? Is it just the other database that doesn’t recognize it, or does the database where you created it not recognize it either?


#3

Thank you for answering me !
I crated this global variable in a database called “MercureX” like this : Global gMENU.
gMENU=info(“databasename”)
It appears correctly in this database in a text display object.
In an other database also open called “CabContacts” : "Field or variable gMENU does not exist. This database is opened with a procedure in “MercureX”.


#4

If the form in CabContacts was opened before the global variable was declared, that error might simply be a holdover from when the variable actually didn’t exist.

ShowVariables gMenu

might be all that is needed to make it display the value.


#5

CabContacts opens after declaration of global variables. ShowVariables gMENU doesn’t change anything.


#6

The only thing I can think of in that case, is a discrepancy in the spelling.


#7

I verified many times the spelling. I quitted many times Panorama and relaunch it. But nothing changes.
Thank you


#8

Try running message info("globalvariables") to see if it shows up in the list. Other than what Dave has already suggested I can only think one other way it would not show up in the second database and that is if you inadvertently declared it a fileglobal instead of a global variable.


#9

Thank you Gary for your answer.
It is correctly declared as global.
The info(“globalvariables”) shows the global variable gMENU but, on the same form in the text display object “Field or variable gMENU does not exist”


#10

What if you create a second text display object with gMENU as the formula?


#11

Same result…


#12

In the problem form create a simple push button object with just “message gMenu” in the procedure panel. What happens when you press this button in data mode?


#13

“Field or variable gMENU does not exist !”


#14

Sorry ! The message is “Content of variable gMENU has not been defined.” although it is correctly defined in the first database MercureX


#15

That would imply that you have a gMENU fileglobal variable. It could have been declared automatically by a form object, such as a text editor object. The value is being assigned to the fileglobal and the global is left without any content.


#16

Interesting ! I will check… Thanks


#17

The Variable Vue gives gMENU as a file global !


#18

I changed the name of the gMENU and now it works.
Thank you very much !