Labelize & "no value for import() function"

Shouldn’t this work?

I think it might be related to this: Possible problem with assign( function? - #4 by michael and may be the root of many of my problems…

But if that were true, then this should work, but it doesn’t :frowning:

I think it needs curly quotes but that still fails… a shortcoming in labelize( perhaps?

The arrayfilter function requires the formula parameter to be quoted.

Some observations when I tried your formula:
It works if I substitute info(“filevariables”) for info(“globalvariables”)

The formula returns an error when used with info(“globalvariables”) that says "labelize( function error: no field or variable names ‘HotKeyGlobalActionArray’. But there is a variable named HotKeyGloba/ActionArray. You can see the / was removed. But this is some very odd variable; I can’t get any value and I can’t assign a value to it.

This code ended up working:

undefine «HotKeyGlobalActionArray»,viewOrganizerTrash
displaydata arrayfilter(info("globalvariables"),cr(),{labelize(import())})

…or use the catcherror( to take care of the undefined globalvariable HotKeyGlobalActionArray:


This will show that undefined variable name in the list proceeded by “••••”.

On further snooping, I found that HotKeyGlobalActionArray is created in the BUILDWIZARDMENUS in the _PanoramaLib database, but no value is assigned to it as far as I can tell. When I repeat these steps after closing and opening PanX and using a different database, I get more errors, but they seem to occur if a global variable has been created but no value assigned to it. My hypothesis is that labelize( if failing when it encounters a variable that is defined but without any value assigned. I am not sure how one would fix that; maybe one can filter the info(“globalvariables”) list to eliminate variables with no value assigned.

I think Gary’s proposal fixes this problem. Awesome. That catcherror( function is pretty amazing.

Sometimes the Formula Workshop gets confused, as I think it did in your example. It says unknown function name, labelizearray, but that’s not what is entered above. It’s ignoring the (. When that happens, one needs a fresh Formula Workshop.

The other thing that gets confused sometimes is the Help Window; while trying to enter a new search term, windows just start flashing over and over for a while until they stop. In that case, I close all the Help windows and try again, or quit PanX and reopen. Both low priorities for attention; someday, when PanX I being polished, they can be fixed.

When a formula error occurs, the wizard does not update the result value area. I decided a long time ago that this was a feature rather than a bug, but it could be argued the other way. Normally an error message wouldn’t appear in the value area but in the case of the arrayfilter( function it can because of how it embeds a formula into the function. Here you can see that I could easily create this situation:

Chris must have done this, then further editing created an actual syntax error.

Wow, I sure haven’t ever seen that, and I use the Help windows constantly (people think I have all aspects of Panorama memorized, but I don’t). I will keep on the lookout for that though.

Oh, I forgot to address the issue of using labelize( with an undefined variable. I’d never thought of using arrayfilter( to list all variables, cool idea. Here’s a revised version using catcherror( that should work in all cases.

arrayfilter(info("globalvariables"),cr(),{catcherror(import()+": UNDEFINED",labelize(import()))})

Here’s the result on my system, showing UNDEFINED for the HotKeyGlobalActionArray variable.

As Tom discovered, HotKeyGlobalActionArray isn’t used anywhere. I think it is leftover from Panorama 6, so I just deleted it. But still, this issue could come up at any time. It’s always a good idea to use catcherror( defensively.

Thank you for that! I have been using this a lot to help convert my Pan6 app to PanX, and, yay, the darn thing is booting again. While examining my list of global variable (and fileglobals) I have noted that some variables report as expected, like this:

=== ElementTypes ============







=== END OF ElementTypes ============

…while other look like they have been corrupted:

=== ShotTypesDict ============
X$versionY$archiverT$topX$objects܆_NSKeyedArchiver—	TrootÄØ !"#/012;ABCDJKLRSTUYU$null“
Ä	ÄÄÄU"RED"W{99, 5}SRED“3456Z$classnameX$classes_TextOperandToken§789:_TextOperandToken\OperandToken_ExpressionTokenXNSObject÷$%&'(<*=>?.ÄÄÄÄÄV"BLUE"W{46, 6}TBLUE÷$%&'(E*FG?.ÄÄÄÄÄV"BLUE"W{80, 6}÷$%&'(M*NOP.ÄÄÄÄÄW"GREEN"W{60, 7}UGREEN“34VW_NSMutableDictionary£VX:\NSDictionary“34Z[\PVDictionary¢\:\PVDictionary$)27ILQSsy~ëòöú£´∂ªΩø¡√» ÃŒ–“‹‰ÓÛ!,2468:<>DLPU`i|Åî°≥º…ÀÕœ—”⁄‚ÁÙˆ¯˙¸˛
=== END OF ShotTypesDict ============

Is this corruption or just an artifact of how Dictionaries are stored in PanX?


It’s the latter. In Panorama X, dictionaries are a binary datatype.

There is a special statement for logging dictionaries. You won’t be able to include them in your “dump everything” routine.