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.
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.
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.
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.
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.
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.)
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.
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:
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.
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…)
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.
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.