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:
filevariablevalue("CODE#")
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.