Objectinfo( to Return Item Number for Popup Menu

I’ve begun the task of converting our Panorama 6 databases to Panorama X and have the first of what I’m sure will be many questions.

In Pan6 I have a popup menu called “QuickPick” which is used to quickly switch between currently selected records. Because it’s possible the popup menu may contain identical items, I must use objectinfo( to return the item number of the chosen item:

    Object "QuickPick"
    item= objectinfo("#POP-UP LAST ITEM") 

But in PanX it appears that the “#POP-UP LAST ITEM” parameter is no longer valid. I’ve searched the Panorama Help on objectinfo( and cannot find a new parameter to return the item number. Does it exist?

No, it doesn’t exist. In fact, most likely no objectinfo( option beginning with # from Panorama 6 will work with Panorama X, as those options were dependent on the internal structure of Panorama 6 objects.

Panorama X has a new ability for you to assign a unique menu identifier value to each menu item. This is done with the menuitem( function. In your case I would suggest using the info(“serverrecordid”) function for the unique identifier (in Panorama X, this function returns a unique number even for single user databases).

Actually, in your case you will probably want to use the arraymenuitems( function, which also has an option to assign menu identifier values. Your menu formula will look something like this (I’m assuming your database has a field called Name, substitute whatever formula you need to create your menu items).

menu("QuickPick")+
    arraymenuitems(
        Name,
        "Identifier",str(info("serverrecordid"))
    )

The code that runs when the menu is clicked will look like this:

find info("serverrecordid")=val(info("menuidentifier"))

This will find whatever record the user picked. Note that this code goes in the Code panel for the popup menu object.

Thanks for the help, Jim!
I ended up using arraymenuitems( with the “EXTRAARRAY1” and “CODE” options which made perfect use of arrays already in place.
Here’s the code I inserted for the Formula of my popup menu:

menu(“QuickPick”)+
arraymenuitems(
RecordsSelected,
“EXTRAARRAY1”,IDsSelected,
“CODE”,{
IDPicked="«1»"
Find ID=IDPicked
Call .CurrentRecord
}
)

1 Like