3

Using MMA 12.2

MMA offers a very nice table associated with each of the planets. Here is the code as an example:

Entity["Planet", "Neptune"]["Dataset"]

Here is the table it produces:

enter image description here

What I want to accomplish is:

  • Create checkboxes for each of the planets
  • All blank initially
  • Upon having one 'checked', it launches the code that produces the table (above)
  • Further, have secondary selections either overwrite the first or delete it and load the new one

This does not HAVE to be done using checkboxes. It seemed low-profile in appearance and the first thing that came to my mind.

Here is what I have thus far:

DynamicModule[{selectedPlanet = None}, 
Column[{CheckboxBar[
Dynamic[selectedPlanet], {"Saturn", "Mars", "Neptune"}], 
Button["Open Dataset", 
If[selectedPlanet === None, 
MessageDialog["Please select a planet."], 
Entity["Planet", selectedPlanet]["Dataset"] // Print], 
Method -> "Queued"]}]]

It works. It is not very appealing, but the table it brings up is void of any data other than the row 'headings'.

Here is the checkbox:

enter image description here

Here is the table:

enter image description here

I am stuck.

user444
  • 2,414
  • 1
  • 7
  • 28
fiz
  • 736
  • 1
  • 6
  • 13

1 Answers1

3

Entity["Planet", selectedPlanet[[1]]]["Dataset"] instead of Entity["Planet", selectedPlanet]["Dataset"] The value of "selectedPlanet" is, for example, {Mars}, that is, a list. By adding the Part specification, we get Mars - not a list.

Rabbit
  • 701
  • 2
  • 5
  • 14