Field acts empty but isn't

Working on a file converted from Pan 6. One text field is named «E mail». (Yes, I know, very original). My procedure that accesses this field insists it is empty, but I can see data in it, on my form in a TEO, and in the datasheet. My original code is:

CASE strip(«E mail») <> ""

but this CASE fails to trigger.

I made another simple procedure containing this statement:

 message «E mail»

The message is completely blank. If I access a different field with a message statement, it is displayed normally. I tried several other fields, all OK.

This happens on different records, that have visible text data in this field.

I’m going crazy.

I hesitate to mess with changing the name of the field, or making any other structural changes, since I will need to import our working data from the Pan 6 files after I finish the conversion to Pan X. But, I can try whatever is suggested.

I don’t suppose this particular field name is reserved…

My guess is that you have somehow managed to create a variable with that name. Variables take precedence over fields, and that one appears to contain empty text.

A suggestion for porting Pan6 files to PanX… I also have and had a lot of field names that I wanted to “improve”. As I build the PanX files I’m taking notes of the new improved field names. Prior to exporting from Pan6 I can run a procedure that changes the field names from the likes of «E mail» to Email. Then the data transfers just fine and I’m no longer stuck with choices made a long time ago.

I can also have my preparatory procedure do any reformatting or cleanup of data to be sure it’s clean and ready to use in my new files.

Dave’s guess sounds likely. If that is the case, you can access the field value using the fieldvalue( function, even if there is a variable with the same name.

Yes, another dave is correct. Searching the forum, I found gary’s WONDERFUL utility “Variable View” which shows that I do indeed have a Global variable named “E mail” that is overriding my field of the same name. His utility doesn’t seem to have any way to show where a variable is defined or used, that I can see.

The fieldvalue( function does let me get the field value, but I wouldn’t relish having to go through all my procedures to insert that everywhere, or to add a new local var in each proc to hold the value and rewrite all my code. Thanks, Jim, for that info!

My next step is to find where the problematic variable is defined, and used, but now I need some suggestions for that task. Opening a View to search on “E mail” brings up many procedures, and I didn’t get lucky searching on “global E mail”. I don’t think I have ever tried to create a variable with a space in the name, anyway.

Another clue: the procedure has run fine for years in Pan 6, and still does so now (sorry Jim, I’m sure you must be awfully tired of hearing that!).

So, this variable with a space in the name seems to have somehow appeared in my Pan X version of the file, but I can’t find it.

Do you mean the View>View Search window? If not, that would be my suggestion.

Well, that definitely isn’t going to work. You might get lucky with

global «E mail»

However, that’s not guaranteed, because the «E mail» variable might be in the middle of a list of variables.

Also, there might not be any global statement at all. You might have a form that has a variable scope of global (though that is a very bad idea for this exact reason). You can see and modify the scope in the Form Properties panel. The only good news is the the View Search panel will search forms as well as procedures. So if you see any forms that contain E mail in the search results, that’s a good place to look.

Another thing to keep in mind is that global variable stick around until you quit Panorama. So the procedure or form that created this variable might not even be open any more! Of course if it’s not open, you’ll have a devil of a time finding it!

That’s because there is no way to find that out. Gary’s utility is simply using the info(“globalvariables”) function, which doesn’t provide any information beyond the list of variable names.

I’m afraid that is not a clue. Panorama X handles global variables exactly the same as Panorama 6 did. I’m confident that if you opened the exact same databases and forms in Panorama 6 and performed the same steps, you’d encounter the same problem. Except in Panorama 6 you’d have no View Search to help track it down.

One way to track this down would be to open Gary’s Variable View first. Then open one of your databases, then press the Refresh button on the variable list to see if the variable shows up. Keep repeating (run procedures, open forms, open databases) until you see the variable in the list, then whatever you did last is where to look for the problem.

Or, you could use the View Search and go thru every single hit.

There is no “quick” fix for this. Since there isn’t, you might just want to rename the field, and use the View Search to show you every spot that needs to be changed.

This is an excellent illustration of why I have repeatedly strongly urged avoiding global variables altogether. Thirty years ago they were the only option, but not any more. If you feel you must use a global variable, give it a ridiculous name that you would never use for a field, like gUniversalEmailAddress.

Honestly I am, especially since it is almost never a useful clue, especially at this point 6 years after a significant number of users started using Panorama X. But I’m sure that I will continue to hear it for years to come. Definitely a first world problem for me, but thank you for acknowledging it. :slight_smile:

Keeping in mind, that once a global variable is created, it doesn’t go away until you quit Panorama, you might want to ask yourself if you had earlier been using a database containing code that you didn’t write. If such a database exists, that would be a good place to start your search.

SOLVED. I found it.
I have two files that run together, let’s call them A & B. File A has a field named “E mail”. File B does not have that field. The mystery Global Var of the same name was appearing and causing a clash with the field in File A. I discovered the Global var was getting created when I opened a certain form in File B.

I finally traced it down to a Text Editor object in that form. The TE was attached to a “Field/Variable” named “E mail”, but since File B doesn’t have that field, a Global var was created when that form was opened. (Of course, the form properties were set to create Globals, which I guess is the default when a form is brought in from Pan 6?).

I went back to the Pan 6 file, and found that same TE was attached to a DIFFERENT field, which happened to be the very first field in the design sheet. Here’s what I think I did in Pan 6, some time back. I copied a group of TEs from File A into this form in File B. In Pan 6, if a TE is attached to a non-existent field, it (I assume) defaults to displaying the first field in the design sheet (ie at the top of the list). However, it seems internally Pan 6 still “remembers” the original attachment.

When I brought these files into Pan X, the original field name was still there for that TE, and was dutifully listed in the properties. But since that field doesn’t exist in File B, Pan X created a Global Var of the same name, causing my field/var name conflict back in File A.

MANY, many thanks to Gary for his invaluable Variable View tool, that allowed me to see when the Global var was suddenly showing up!

For the record, hoping it may help others, my debug procedure was:

Quit Pan X
Open Variable View, and set it to search for a Global var named “E mail”.
Use Find & Open… to Open Data Sheet Only (right click) for my file.
Open a form in my file and check VV to see if the global var appeared.
Duplicate the problem form, and delete some of the stuff on it (it had many TEs and other stuff, and I did not know where the problem was).

QUIT pan X, and start over, this time opening the modified form.

Repeat many times until you find what was creating the Global var.

I couldn’t find any way to “search through one form” for a field or variable. If there is a way please let me know.

One more thing: I always had to use Find & Open TWICE. The first time it would fail to open the data sheet. Seems it may somehow be connected with VV, but it is still a very valuable tool!

No, this is configurable in both Panorama 6 and Panorama X. Panorama X brings over whatever settings you had in Panorama 6, so. you must have set this originally there.

You can create a blueprint for the form and search through that. Use the Entire Form option.

As I mentioned earlier, you can also use the View Search window to search for any procedure or form that contains a field or variable. For forms it won’t tell you where in the form the field or variable is used, but you can at least know which forms you need to look through. You’ll need to enable the Full Source Search option.

You didn’t need to quit to get rid of the global variable, you can do it with a one line procedure.

undefine «E mail»