Tinderbox Forum

Separating out imported attribute values into a set

I’m just getting started, so thanks in advance for any help on this.

I’ve got some data I’m importing from a spreadsheet, where there is a field called Codes, which has multiple values separated by commas. (There are no commas in the values themselves.) I would like to do separate out each value, and have the values become choices chosen in a set-type attribute for that note. Each note will have a different combination of one or more values, some of which may appear on more than one note.

For example, while the Code for one particular note originally is =“modularity: effort to design, modularity: miniaturization of technology” (one value), I would prefer it to be Code=“modularity: effort to design, modularity: miniaturization of technology” where the Code attribute is a set… something like this (here I just added the suggested values by hand):


(two values)

How can I automate this process as I import more notes (which may have new values)?

Thanks!

You could add the proposed values, as a semi-colon delimited list, to the suggested values field of the attribute in the User Attribute pane of the Document inspector.

OK, set up your $Code user attribute as Set data-type. Make sure the imported spreadsheet has ‘Code’ as the column header. In your source document/script, go into the Code column and change all the column valuers so all commas, or comma+space(s), become semi-colons. Then, when you import, each discrete value will be added to the $Code attribute as one or more values.

The method mentioned by @eastgate is for populating an attributes ‘suggested value’ list, described in more detail here. It help making it easier to add new attribute values from a pop-up list, even if they don’t yet exist as an actual value in any note (see the link I’ve already given).

Are semicolons also the best way to separate tags? (Using the built-in References/Tags attribute.)

That worked perfectly, thanks so much.

And thanks for all the quick replies!

Any list based attribute, built-in or user created, i.e. those of the List or Set types, stores its value(s) as a semi-colon delimited list.

As $Tags is a Set-type attribute, hopefully you can see it falls into the group of attributes I’ve just described.