Illegal Field name or arrayselectedbuild bug?

A file I’ve been using for 20 years has developed a problem.
Simplified I have a field CODE# and a field BALANCE. Both are integer fields.

When I run the following code:

local lvArray
arrayselectedbuild lvArray,cr(),"", «BALANCE»+tab()+«CODE#»
displaydata lvArray

The data in CODE# does not show up. If I change the field name to CODEX, the arrayselectedbuild gets the data. Is the hashtag a forbidden character?

No, there is not forbidden character in a field name (except for » I suppose). A hashtag should be fine, as long as the field name is surrounded by « and », as you have done. From the information you have provided, I cannot tell you what the problem is.

The code you have supplied has definitely not been working for 20 years, it would not work in Panorama 6 or earlier, which required that numeric fields be explicitly converted to text with either the str( or pattern( function. Your code does look ok for Panorama X.

I made a database with the same field names you used, and tried out your exact code (I copy/pasted it from the forum, so I would use the exact same code). As you can see, it worked fine (I did add the width/height options to displaydata, but made no other change to your code):

Is there any chance that you have two CODE# fields in your database. Normally Panorama X won’t let that happen, but I think if you transferred over a Panorama 6 database with two fields with the same name it would allow it. But this could cause the symptoms you describe.

Or, perhaps more likely, if you have a global or fileglobal variable named CODE#, that would cause this problem. I just verified this with this code, which produces the symptoms you describe:

local lvArray
letfileglobal «CODE#» =""
arrayselectedbuild lvArray,cr(),"", «BALANCE»+tab()+«CODE#»
displaydata lvArray,{width=400 height=300}

An easy way to verify this is to open the Formula Workshop and try this formula:


If there is an error, the variable doesn’t exist. If there is no error, there is a variable with that name. You can get rid of it with the undefine statement, but more importantly you will need to go thru all your code to figure out where you set up the variable in the first place. You’ll have to decide which is easier, getting rid of the variable or changing the field name.

As has become a recurring theme with me. I tried it again this morning and it worked as expected. I did not change a thing, and believe me, I spent about an hour troubleshooting and experimenting yesterday.

filevariablevalue(“CODE#”) produced no value in any of the files I had open.

Yes, in Pan6 I was using str(, and that’s what I started with yesterday.

I wish I had thought of the variable possibility yesterday and I would have tried explicitly undefined it, though I can’t see anywhere that I have used it as a variable.

Thanks for the reply

Did you close the file and re-open it since yesterday? That would get rid of any fileglobal variable that was hanging around. If it was a global variable, quitting and relaunching Panorama would get rid of it. If the problem comes back, I would look for an extraneous variable with that name.