When creating custom metadata fields using the metadata configuration tool, one of the available field types is Bag of struct.
Currently only supported for use in FotoStation, a bag of struct makes it possible to create a bag field that contains several linked sub items.
A practical example is address information records, where sub items could include street, number, city, state and country.
When a bag of struct is used in a FotoStation metadata editor, it displays as a table with individual "records".
Tip: The Metadata Import / Export feature in FotoStation also honors bag of struct content and will correctly extract data from and write metadata to the fields within the struct.
Setting it up
Create a custom metadata field as explained in the Adding fields to a namespace topic.
When you get to the point where you choose the field type, choose Bag of struct:
In the example above, we've created an address field that contains child items Street, Street number, City, Region/State and Country.
- Start with the Field name field shown in the above screenshot. Here you enter a name for the field - this is the label that is stored in the xmp block of the assets you add information to, so you should make sure to use only letters (upper or lower case) and numbers for the field name. It may not begin with a number or contain spaces.
Tip: You can change the actual field label that users see by setting a Display name for the field later on the Field ID tab.
- Next, choose the namespace to add the field to if it hasn't already been set in the Namespace drop down menu.
- Now, add struct members (child fields) to the field by clicking on the green +
- Create a struct member by choosing a field name and a corresponding Display name that is shown to users in the FotoStation user interface. When setting the field name, use only letters (upper or lower case) and numbers for the field name. It may not begin with a number or contain spaces.
- You can also specify a data type, the maximum number of characters allowed and optionally a regular expression to validate user input.
Learn more about these options in the Adding fields to a namespace topic.
- Click OK to store the field and continue creating additional struct members as needed.
Adding a bag of struct to FotoStation's metadata editor
Having created your custom field, this is how you add the field to a metadata editor:
- Open the program configuration (File | Configuration...) and expand the Metadata node.
- Select the Dialog builder node and select the metadata editor you'd like to modify. Then click on Edit to open the dialog builder with that editor.
- Locate the field you created and drag it onto the editor, either on a new tab as shown in the screenshot below, or onto an existing tab. Then size the field as you prefer.
- Finally, Click on OK to store the metadata editor. Now you're ready to start using it.
Adding metadata to assets
Now, pick one or more files in FotoStation't grid and open the metadata editor. The bag of struct field you created should look similar to the screenshot below:
Use the + icon to add a new metadata entry. A dialog will open and allow you to fill in all fields in the struct.
You can edit an existing record by selecting an entry in the table and clicking on the icon with the pencil, and entries can be deleted by selecting them and clicking on the - icon.
How is this data stored in XMP?
The XMP standard supports bags containing structs natively. In fact, you can expose the XMP block of a file entirely by right-clicking on the thumbail in FotoStation and opening Properties. Then open the XMP tab in the file's properties, and expand the namespace containing the bag of struct to see how it's stored. As you can see in the screenshot below, the address field we created in this demonstration contains a single sub item where all the address fields are listed. Creating a new address entry would generate a new node in the XMP with an index number 2, and so on.