Dynamic Pop-up Menus

Part 1: Is it possible to have a pop-up menu reference a group of cells on a different table? I want the pop-up menu to get populated with the values in the other cells. Let me give you an example:


A1 = Banana

A2 = Orange

A3 = Apple


I would like to have a pop-up menu (on a different sheet) read:

Banana

Orange

Apple


Part 2: If Part 1 was possible, is it also possible to have the pop-up menu update itself automatically? Let's say I add A4 = Pineapple to my table. Could I get my pop-up menu to automatically have "Pineapple" as an option or must I manually type it in as a selection?


Thank you so much for your help. I have tried to find this answer but have had no luck. Have a good day.

MacBook Air, OS X Mavericks (10.9.4)

Posted on Aug 12, 2014 7:51 PM

Reply
33 replies

Aug 13, 2014 7:08 AM in response to Yellowbox

Hi Ian,


Call me brilliant anytime.

I wish I know how to link to individual replies, I would send people trying to understand popups to your answer here. I can only get a link if someone has responded to a post. (doing that now).


I use a popup for a client list and it is a little work to update it. Generally I use a variation on your last method. I have my client list and add the new client to it. Select the list and choose text as format. Alphabetize the list. Choose popup as format. Copy and paste to where I need it.


ciao,

quinn

Aug 13, 2014 8:18 AM in response to t quinn

Hi Quinn,

I would send people trying to understand popups to your answer here.


It looks like it is time for you and I to start composing a User Tip on Pop-Up Menus in Numbers 3. You will be an equal co-author.

I can start a draft User Tip, but I would prefer to avoid cluttering this forum with drafts or published "half finished" tips. If you feel OK about this, click on my name/avatar to see my profile. Email me with details and anonymous examples of what you do now (I had a play with your method, but ran into a brick wall).

I use a popup for a client list and it is a little work to update it. Generally I use a variation on your last method. I have my client list and add the new client to it. Select the list and choose text as format. Alphabetize the list. Choose popup as format. Copy and paste to where I need it.


ciao,

quinn



Regards,

Ian.

Aug 15, 2014 8:53 PM in response to Yellowbox

Hi Ian,


Don't know if this eventually will prove useful in "faking" dynamic Pop-Up Menus, but it turns out AppleScript can automate some of the process:


For example try this on your Table 1 above:


property targetRange : "A2:A5"
tell application "Numbers"
  set t to front document's active sheet's first table whose selection range's class is range
  tell t
  set selection range to range targetRange
  set selection range's format to pop up menu
  end tell
end tell



SG

Aug 17, 2014 2:31 PM in response to t quinn

If the "2" in propertysubMenuCol : 2 is changed to "1", then "Microphone" would be overwritten with the popup from the Microphone table. This is great. I can call the popup to any column A cell if I enter the table name of the popup.

This doesn't seem to work if the value "Microphone" is in a popup, only if it is text. Rats.

quinn

Aug 17, 2014 7:07 PM in response to t quinn

Hi quinn,

Your description of what the script does is right on.


Here is a more generalized form addressing your questions. The property names are more descriptive. If you want to look in column C for the name of the table with the menu values, you would change subMenuCol to 3.


If you want to keep all your tables with menu values on a separate sheet you would change nameOfSheetWithMenuValuesTables. (That works fine, but causes a "jumping to and back" animation.)


The script is set up to copy the last cell in a table with the menu values, which in my example is always formatted as Pop-Up Menu set to 'None' (blank). But if you want the default value in the 'submenu' to be something other than blank you could have the script point to another cell in the table (change 'to last cell' to 'to second cell' or 'to cell 2', etc., etc.).


This script could easily be turned into an "app" that runs entirely automatically in the background at specified intervals if one typically enters new data in fairly large batches.


SG


property nameOfDataEntrySheet : "Sheet 1"
property nameOfSheetWithMenuValuesTables : "Sheet 1"
property nameOfDataEntryTable : "Table 1"
property mainMenuCol : 1 --> specify the column with the "bigger" categories 
property subMenuCol : 2 --> specify  the column for the "submenu" pop-ups "dependent" on the bigger categories
tell application "Numbers"
  set d to front document
  set s to d's sheet nameOfDataEntrySheet
  set m to d's sheet nameOfSheetWithMenuValuesTables
  set t to s's table nameOfDataEntryTable
  tell t
  try
  repeat with i from 2 to count rows
  tell m's table (row i's cell mainMenuCol's value)
  set selection range to last cell
  activate application "Numbers"
  tell application "System Events" to keystroke "c" using command down
  end tell
  set selection range to column subMenuCol's cell i
  tell application "System Events" to keystroke "v" using command down
  end repeat
  end try
  end tell
end tell

Aug 18, 2014 10:27 AM in response to t quinn

Hi quinn,


Tough to see what's going on. Are those "blank" cells in column C after the first run actually Pop-Up Menu cells showing the default 'None'? Or are they true blank cells?


And why would you want to have the same value in column C as you have in column B? Wouldn't you want "submenu" choices there.


To post scripts the closest I can get is 'use advanced editor' and choose >> syntax highlighting plain.


SG

Aug 18, 2014 11:23 AM in response to t quinn

The script works substantially better if I convert my control column to text first.


What do you mean by "control" column? If it's the "mainMenu" column and you've formatted it as Pop-Up Menu instead of text, then you can try using 'mainMenuCol's formatted value' instead of 'mainMenuCol's value'


Why is it that you want the same value in C as you have in B?


Do the tables with the values for the submenus have names that exactly match the values in 'mainMenuCol'?


If you post what the menu tables look like I can troubleshoot.


Because this is a gui script (no choice, unfortunately) sometimes you have to use the delay statement to allow the interface time to keep up.


SG

Aug 22, 2014 7:03 AM in response to GWBush

Hi GW,


I actually know how you feel. I am trying to wrap my brain around Apple Scripting because that seems the only way to get our popups to update without doing it manually.

In my situation, I want to be able to update the popups that haven't been used in a table. I have figured out how to flag them and am trying to figure out how to modify SG's script to only look for flagged rows.


Keep an eye out for a User Tip from Yellowbox on popups. He may roll it out in stages and dynamic popups will be a later stage. They will probably involve Apple Scripts but once they are written it is relativly easy to use them.


ciao,


quinn

Apr 14, 2016 10:41 AM in response to t quinn

Hello All,


Newbie here! - Is there a way to have a preset list of values in a column available for the pop-up menu but also add an Error message if the value has been already used?


Example Column #1 -

Pop up values for each cell

100

101

102

103

104

105


If I select say "100" in any cell in the column, if I try to select it again, I get an error message or a literal red flag. I guess the other possibility would be to have a way to remove that data choice from the pop up if its already been used elsewhere in the column.


Is this possible?

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Dynamic Pop-up Menus

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.