Message Boards Message Boards

1
|
3164 Views
|
19 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Why Dataset does not accept to add two more lines in an element?

Posted 2 years ago

Why Dataset does not accept to add two more lines in the "quantifying" element (and returns an Association instead of making the 2 more lines)?

How to make the 4 rows of "governing" to appear instead of only the 2 first one and a gray line saying "4 total >"?

Dataset[
 {
  Association[
   "Workflow" ->
    Association[

     "modeling" ->
      Association[
       "binarizing" -> binarizing,
       "quantifying" -> Association[
         "framing" -> framing,
         "deriving" -> deriving
         ]
       ],

     "simulating" ->
      Association[
       "decomposing" -> decomposing,
       "transforming" -> transforming
       ],

     "governing" ->
      Association[
       "testing" -> testing,
       "observing" -> observing,
       "controling" -> controling,
       "solving" -> solving

       ]
     ]
   ]},
 ItemSize -> {Automatic}
 ]
POSTED BY: Gianni Mocellin
19 Replies

Dear Eric,

I did not change the structure of my code: I only SIMPLIFYED IT FOR YOU.

So:

1/3: I do not need neither "advises" neither "judgements" but "solutions";

2/3: as per "pictures", I am not a not a good "painter", only a Civil engineer from the Swiss Institute of Technology (1975), a Master in Business Administration (1978), a PhD in Economics (1991), a Master in Artificial Intelligence from the SIT (1986) and a Master in Robotics also from the SIT (1987).

Maybe all that "stuff" explains my obstination at "finding" working solutions to "real problems" and not "guessing" hypothetical solutions about "dreamed problems".

3/3: as you are "no longer interested" I will not ask you to tell me where precisely in the documentation about building user interfaces I can find the solution to my problem...

And also, please, as you are "no longer interested", FORGET this discussion (which, I know) is followed by several skilled Mathematica programmers who try to solve the problem with myself.

Kindest regards.

Gianni

POSTED BY: Gianni Mocellin
Posted 2 years ago
POSTED BY: Eric Rimbey

OK, Eric.

As per your request, I put hereunder what I want "with a menu inside"

I have set twice the same Plot function in both items of the menu for simplification.

Here is the menu:

simulatingSytemsMenu = ActionMenu[
  "Systems",
  {
   "SystemModelSimulate" :> 
    NotebookWrite[SelectedNotebook[], 
     Cell[{ToBoxes[Plot[Sin[x], {x, 0, 6 Pi}]]}, "Output"]],
   "SysteModelPlot" :> 
    NotebookWrite[SelectedNotebook[], 
     Cell[{ToBoxes[Plot[Sin[x], {x, 0, 6 Pi}]]}, "Output"]]
   }
  ]

And here is the Dataset with the menu being active:

Dataset[
  Association[
  "Modeling" -> modeling,

  "Simulating" -> Dataset[simulatingSytemsMenu],

  "Governing" -> governing
    ]
  ]

The reason I put a second Dataset inside "Simulating" is that if you do not put this second Dataset you get "three points" in the element instead of the menu (which is another mystery...)

Dataset[
  Association[
  "Modeling" -> modeling,

  "Simulating" -> simulatingSytemsMenu,

  "Governing" -> governing
    ]
  ]

Regards.

Gianni

POSTED BY: Gianni Mocellin
Posted 2 years ago

Maybe you can just draw us a picture of what you want. You should also include the menus that you want, just so that doesn't become another stumbling block after we get the layout sorted. But be prepared for suggestions that don't use Dataset.

POSTED BY: Eric Rimbey
POSTED BY: Gianni Mocellin
Posted 2 years ago

Crossposted here.

Gianni if you are going to crosspost please add bidirectional links to the posts. This avoids the situation where someone wastes time answering the question on one post when it has already been answered in the crosspost.

POSTED BY: Rohit Namjoshi
Posted 2 years ago

Okay, have you tried nesting Datasets then?

"binarizing" -> 
 Dataset[
  Association["asserting" -> asserting, "infering" -> infering]]
POSTED BY: Eric Rimbey
Posted 2 years ago

POSTED BY: Eric Rimbey

OK, Eric.

You end up with the samething I arrived at with Grid,

The reason why I switched to Dataset are:

1/2: incomparable better visual presentation (especially when you put all that in a Palette supposed to be used by a non computer scientist;

2/2: the fantastic job they did at Wolfram with Dataset: only have a look at the Details and Options of the documentation...

Gianni

POSTED BY: Gianni Mocellin
Posted 2 years ago
POSTED BY: Eric Rimbey
Posted 2 years ago

Yes, the whole data structure is nested Associations. I get that. Just don't wrap it in Dataset. Instead, build your own functions to operate on the nested associations to get the effects that you want.

POSTED BY: Eric Rimbey

They are nested associations, Eric.

Check again the element "binarizing".

Furthermore, why not to use Dataset to display a list of Associations as you mentionned in your precedent reply?

POSTED BY: Gianni Mocellin
Posted 2 years ago

Maybe that was too brief. My suggestion (just based on what you've told us so far--there may be better options if I knew more) is to use the nested Associations as the data representation of the menu hierarchy that you eventually want. Then you'd define functions that operate on that data to 1. produce the menus, 2. apply the layout you want.

POSTED BY: Eric Rimbey
Posted 2 years ago

Okay, based on that info, I'd suggest that you just use the Associations and don't wrap it with Dataset.

POSTED BY: Eric Rimbey

OK, Eric.

The objective is not purely visual.

In my program (includig "asserting" and "infering" in "binarizing") each blue value of each Association will be an ActionMenu, which is the opposite of a purely visual interface (I already tried many solutions with Grid before trying Dataset).

The problem is not to think about what Dataset is trying to figure out but to find a solution to build the hierarchy.

Anyway, thank you for your suggestions Eric.

Regards.

Gianni

POSTED BY: Gianni Mocellin
Posted 2 years ago

Gianni, what is your objective? So far it looks like this is purely visual. If you just want a visualization, there are better options than Dataset. If you're going to process this data somehow, then it would be helpful to know that, because forcing the visualization you want with Dataset could make further processing more difficult.

But what I think is happening here is that Dataset is trying to figure out what the values should be at the lowest level. It's trying to determine the "shape" of the hierarchy. What it finds at the lowest level is some symbols and an Association, so it is assuming that those are your "values" and that everything above is "keys". If it were to interpret that last Association as more keys with values, then it wouldn't have keys at the appropriate level for the other values.

POSTED BY: Eric Rimbey

Dear Rohit,

The problem now is that Dataset does not seem to accept to add 2 more lines, like in the "binarising" element for example, and returns an Association instead of making the 2 more lines in the Dataset.

Dataset[
 {
  Association[
   "Workflow" ->
    Association[

     "modeling" ->
      Association[
       "imagining" -> imagining,
       "binarizing" -> Association[
         "asserting" -> asserting,
         "infering" -> infering
         ],
       "quantifying" -> quantifying
       ],

     "simulating" ->
      Association[
       "decomposing" -> decomposing,
       "transforming" -> transforming
       ],

     "governing" ->
      Association[
       "testing" -> testing,
       "observing" -> observing,
       "controlling" -> controlling,
       "solving" -> solving

       ]
     ]
   ]},
 ItemSize -> {Automatic},
 MaxItems -> {All, All, All, All, All}
 ]
POSTED BY: Gianni Mocellin

Thank you for the prompt answer and solution, Rohit.

Kindest regards.

Gianni

POSTED BY: Gianni Mocellin
Posted 2 years ago

Hi Gianni,

You can specify the maximum number of items to display at each level using the MaxItems option. Add

MaxItems -> {All, All, All}
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract