I have a piece of code where POP.UP is being called with MODE of 'T', SELECT (the data passed) is an @FM-delimited list of keys, and FILE is an open file handle into the file where these keys reside. In the first part of the FORMAT definition, I would like to put the name of a symbolic in that file, rather than a field number. I know that you can do this when building a popup in the Design menu, and according to the documentation you can do this when calling POP.UP directly. However, what I get is a message " cannot be executed" followed by a break to the debugger in routine RTP12 (SELECT). I have tried putting quotes or angle brackets around the symbolic name, and it doesn't help. Any suggestions?
It sounds like @DICT is not set to the dictionary where the symbolic resides.
If you "OPEN filename TO filehandle ELSE … ", the filehandle variable contains a lot more information than just the filename. You can view it by creating, cataloging and running a TESTING program:
DECLARE SUBROUTINE MSG
OPEN "FILENAME" TO FILEHANDLE ELSE STOP
MSG(FILEHANDLE,"","","")
You'll have to pass an actual filename as a POP.UP parameter.
Also, shouldn't the keys be @VM-delimited rather than @FM-delimited?
Well, the documentation says to pass either a "file variable (a previously opened file)" which I took to mean a file handle, or "@filename", which means POP.UP has to open the filename (ie: filename is just the name, not the handle). As I said, if you pass a file handle, it works ok providing that the fields specified in FORMAT are just numbers, but it crashes if you specify symbolics or other fieldnames.
I just tried passing the filename (with @ in front of it), and now it does work, even with symbolics, so I've now fixed the problem. As Larry Wilson suggested, possibly @DICT must be open before it can recognize the symbolic name… but I had tried that already (I just forgot to mention it in my posting). Therefore, this alone is not sufficient. I would suspect that even though it is undocumented, the use of field names rather than numbers requires something else to be set (maybe @PRI.FILE?) and this happens ONLY if you get popup to open the file for you. Passing the file handle is not a good idea in this case.
By the way, if mode is 'T', the list of keys passed IS @VM-delimited, not @FM. I'm sure of this, because my code works.
Peter
Addendum to last: the reason I had the wrong delimiter was because I was testing my popup with a single key, and therefore the delimiter was irrelevant. You were right, it does have to be @VM.
Peter
I had tried that already, and it didn't help. I just forgot to mention that in my original posting. Good call though.