Message Boards Message Boards

1
|
3068 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

which is another mystery

Well, I did advise you against using Dataset. You seemed pretty adamant that Dataset was the best solution. It's a bit upsetting that you knew there were multiple points of failure with your strategy, and yet you completely discounted my advice.

But regardless, what you've provided doesn't help. You've changed the data in your hierarchy, so I don't really know what the "shape" of this data is supposed to be. Also, I asked for a picture. I'm not really interested in an approximation that you're already dissatisfied with. I was asking for a literal picture so that I could stop guessing about what you were trying to achieve.

But, full transparency here, this is no longer interesting to me. My advice is that you read some of the documentation about building user interfaces, e.g. http://reference.wolfram.com/language/workflowguide/CreatingAndOrganizingInterfaces.html .

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

Dear Rohit,

I thought that the "Wolfram Community" site and the "Mathematica Stack Exchange" site where 2 independent enitties and from now on I will avoid crossposts and add bidirectional links if necessary according to your instructions.

By the way, at the moment, NO SOLUTION TO THE PROBLEM of "the 2 lines" has appeared in neither of the 2 sites.

Proof: I tried "nesting Datasets" before the suggestion of Eric it in his last reply:

"binarizing" -> 
 Dataset[
  Association["asserting" -> asserting, "infering" -> infering]]

But the result gave a kind of mix of Dataset and Grid as you can check with the hereunder code,

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

     "modeling" ->
      Association[
       "binarizing" -> Dataset[Association[
          "asserting" -> asserting,
          "ruling" -> ruling,
          "infering" -> infering
          ]],
       "framing" -> framing
       ],

     "simulating" ->
      Association[
       "decomposing" -> decomposing,
       "performing" -> perfoming
       ],

     "governing" ->
      Association[
       "testing" -> testing,
       "observing" -> observing,
       "controlling" -> controlling
       ]
     ]
   ]},
 ItemSize -> {Automatic},
 MaxItems -> {All, All, All, All}
 ]

reason why I am still tracking where I missunderstand something.

Regards.

Gianni

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

I'm suggesting to not use Dataset because (and again, this is just based on the limited info here) Dataset is typically used to model hierchical data that you want to perform queries or transformations on. Getting Dataset to display things a certain way is not easy. Dataset has very strong display "assumptions" built in, and overriding them is challenging.

Imagine if you were using a typical sql-based database for this data. You'd have the same problem. You'd have nested "tables" that eventually need to bottom out with actual atomic values. Those atomic values end up at the same level. So, you either need to wrap your current atomic values in more tables or you need to allow the one "table" that is at that level to just be an atomic value. That's what Dataset did. It said, "hmm, I guess this Association is really intended as an atomic value for the purposes of this hierarchy". (Apologies for my crude description of a database--I didn't think it was important to make that rigorous.)

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