Message Boards Message Boards

0
|
3539 Views
|
2 Replies
|
1 Total Likes
View groups...
Share
Share this post:

Create a manipulate control using data from a dataset?

Posted 5 years ago

Consider the following code:

data = Dataset[{<|"userId" -> 5311, 
    "Rec" -> 
     "You need to improve in Free Response Question type"|>,<|"userId" -> 5312, 
    "Rec" -> 
     "You need to improve in Write Code Question type"|>, <|"userId"-> 5313, 
    "Rec" -> 
     "You have a great performance in all question types"|>,<|"userId" -> 5314, 
    "Rec" -> 
     "You need to improve in Multiple Choice Question type"|>}]

Is there a way to create a manipulate such that the control shows the userId and as I move the control, I see the text corresponding to each userId. Something similar to this:

Manipulate[Grid[{{userId}, {"text"}}, BaseStyle -> {FontFamily -> "Roboto"}], {{userId, 1}, 1, 5}]
POSTED BY: Annesha Bhoumik
2 Replies

Maybe like so:

Manipulate[data[n, "Rec"],
{{n, 1, Keys[data][1, 1]}, MapThread[Rule, {Range[4], Normal@data[All, "userId"]}]}]
POSTED BY: Henrik Schachner

Thanks a lot. This works perfectly.

POSTED BY: Annesha Bhoumik
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