Basics of Datasets


#1

When do I need more than one? How do I move between two datasets?

Thanks :slight_smile:


#2

Yeah, how do we call datasets for different text fields?


#3

From what I've figured out is its for if you have two states of a component that needs different copy. So a primary button for instance, maybe 'Submit' or 'Learn more' but you want them both to use the same element so if you update the style later it updates both.

I could be wrong but here's a quick screen recording to help explain what I mean. Excuse me going to the wrong place a couple of times, still getting used to the UI.

(for some reason I've found you have to right click the video and say open in new tab to watch)


#4

Thanks @toby_burkill! Videos are so helpful!

I've been able to use a single dataset for different states of a component. It works pretty well. You can even use a single dataset for all text across the app, across many different components, states, and regular ol' boxes.

I wondered why you'd choose to use multiple datasets. I can see how you might if you have lots of data and maybe you want to organize it by using one dataset for your button names and one for the amounts in a series of transactions.

While looking into this, here's what I've learned about datasets so far:

  1. Changing datasets. If you give a dataset a name, then you can use the command bar to apply chose that dataset for a text box. @mateus_px I think this might help you.
  2. Duplication. If you duplicate something that contains a text box, it shares the same dataset. I didn't expect this. If you're duplicating a group of elements, it can seem like it's behaving like a component because if you update the text data that is selected for both, they will both update. Something for feature discussion maybe. For now, it doesn't get in my way.

Looks like the data feature is in its early stages. Someday I hope I can dump a whole list in there without having to type in each one. But for now it is pretty straightforward and more reliable than the other data tools I've used.


#5

Re: #2, I think there's a compelling case to change the behavior here.
If you duplicate a text box that is associated with a named dataset, then you probably want the duplicate box to refer to that same dataset --- just as when you duplicate a component you probably expect to get another instance of the component.

But if you duplicate a text box with an unnamed dataset, you probably don't want the two boxes to be linked to the same dataset.
@ryan, thoughts?


#6

I think this is right. The current behavior is pretty confusing: you dupe a text element, start typing to change the text on the new one, and the text changes on both of them. Which is probably not what you wanted, if you haven't named your dataset.

We do sort of have an override for this, command-double click will make a new datum in the data set automatically, so you don't accidentally change the original datum text. Two problems with this:

  • It's not discoverable
  • It's an extra step every time

In terms of arguments against, you could accidentally end up with two datasets where you only wanted one. But if you haven't named it, that's probably not the case. And (tbd) assigning datasets to existing elements shouldn't be too difficult.