CUMULUS POWER TIP:
Setting Label Field Values (Colors) via Formula Use labels to visually indicate values set (or missing) in other metadata fields.
What’s a great way to indicate when an asset record’s metadata is incomplete? How about a nice, bright red label? Now, wouldn’t it be nice for Cumulus to be able to set the value in that label automatically? Using a field formulas, it’s easy to automatically set a label’s value (color) based on values in other metadata fields—you can even indicate when values are missing! Just A String List with Color.
• When metadata is present, we want to green label.
A Cumulus label field is little more than a string list field that displays menus of color chips instead of menus of text. Users select the color they want, and the value of that color is saved in the label field.
• When metadata is missing, we want a red label. • As a safety measure, we’ll include a black label to indicate an error condition. Let’s get started:
NOTE: String List field items, such as label colors, are referenced by item IDs, not by the item text or color. IDs are assigned by Cumulus in the order the items are added to the field. The first item is 0 (zero); the second item is 1; the third is 3; and so on.
Using field formulas, you can test for label colors (items) and even set them. The trick is to use item ID numbers and not the item itself. (Figure 1)
1. Add a new label field to your catalog and create color
items for it as shown in figure 1. We’ll call our new field “Magic Label.” If you don’t get the colors correct while creating the field, adjust them after the item is created. (Click on a color and use the color editor that appears.) Just make sure you end up with three items roughly colored as shown in figure 1. (Don’t forget to add “Magic Label” to a view so you can see it!) 2. Next, we need a field we can “look” into for meta-
data. This can be any Cumulus field type, but we’ll use the “Caption” string field in this example.
The Logic. Before we add our formula to our “Magic Label” field, let’s consider the logic used in the formula. Our goal is to see if “Caption” includes any metadata, so our logic flow will be: FIGURE 1: Accessed via the Properties window of any label field, the Label Editor enables you to add, edit and delete label field items, which are colors. The unique ID assigned to each item is what you’ll reference in your field formulas.
• Look into the “Caption” field. • If “Caption” contains data, set “Magic Label” to 1 (green). • If “Caption” is empty, set “Magic Label” to 2 (red).
The label field shown in figure 1 has three colors (items) added to it, each of which has a unique item value (ID). You’ll use these item numbers to reference field label values in your formulas. Item IDs never change, so you can change the colors used in your label fields, or add and delete values at any time without interfering with formulas already in place. (Cumulus will not “recycle” item IDs, even when a previous item has been deleted and a new one is created.)
Organize. Find Share. Any File, Anywhere. Benefits 1. Automatically set label fields based on values in other fields 2. “Read” label values via formulas 3. Provide visual metadata that’s easy to scan 4. Color labels offer UI elements that are language independent 5. Bring industry or organizational color schema into Cumulus workflows
Ideas for usage • Visually indicate when metadata is missing • Visually indicate when approvals have been granted
• If (for some unforeseen reason) neither of these conditions is true, set “Magic Label” to 0 (black).
• Devise color warning systems for pending expirations
The Formula.
• Turn label values into unique text you can “round trip” via XMP or IPTC
Formulas are always added from the Properties window of the field you want the formula to update. So, in this case, we’ll add our formula to our “Magic Label” field. 3. Open the “Magic Label” field Properties window. 4. Open the Field Values tab and enable the Formula
The Metadata Field Setup. For this simple example, we’ll make some assumptions:
Based Field Values option, as shown in figure 2.
Canto, the Canto logo and Cumulus are registered trademarks of Canto. Other company and product names might be trademarks of their respective owners. Some product claims and features are not included in all versions of the software and/or might require additional Cumulus Add-ons or Plug-ins. C|TIP/FormulasForLabels/V1.0/07.2009
Copyright ©2009 Canto GmbH. All rights reserved. www.canto.com
Page 1 of 2
CUMULUS POWER TIP: Setting Label Field Values (Colors) via Formula
FIGURE 3: If “Caption” includes data when an asset
FIGURE 4: After a cataloging operation, it’s easy to
record is created or updated, “Magic Label” turns green; otherwise, it turns red, helping users see which asset records need attention.
immediately see which asset records need captions— with absolutely no searching or other user action required. Works over the Web too!
false condition. Typically, the “action” is nothing more than putting a value into the formula’s “host” field, and that’s exactly what we’re doing. FIGURE 2: Inside the same Properties window you added your label items (colors), you’ll add your formula. A fallback value is always set to indicate when a formula error has occurred, such as a data corruption.
5. Enter the formula we’ll use into the formula
field, as shown in figure 2: fieldHasValue("Caption")? 1 : 2
Now, let’s get a better sense of what it does. Formula breakdown The fieldHasValue function tells Cumulus to look into the field specified in the parentheses that follow it and see if it finds any value. We’ll call this portion of the formula the “test condition.” Following the test condition comes a question mark. This separates the test portion of the formula from what we’ll call the “action” part. The action portion of a formula always includes two value choices: What should Cumulus do for a true condition and should Cumulus do for a
This Power Tip is known to work in all editions of Cumulus 7.5 and later.
In our formula, 1 is the value we want put into “Magic Label” when data is found (a true condition) and 2 is what we want when our test returns false. (Remember, these numbers correspond to the ID numbers of the colors of the “Magic Label” field.) So, Cumulus reads our complete formula as: If the “Caption” field has a value, then set the value of “Magic Label” to 1 (green). If the “Caption” field is empty, then set “Magic Label” to 2 (red).
The Payoff. When an asset is cataloged, and any time an asset record is updated, Cumulus runs the formula and updates the value of the “Magic Label” field. Figure 3 shows our formula in action on a view created for illustration purposes. Look at figure 4 for a more practical example that shows how a batch of newly cataloged assets can be instantly scanned for metadata omissions thanks to this very simple formula.
For more information on how Canto Cumulus can benefit your organization, contact your local Canto partner, or contact Canto directly. United States +1 (415) 495-6545 Europe +49 (0) 30 390 485 0 Everywhere
[email protected]
About Canto & Cumulus Canto has been dedicated to helping customers fully utilize their digital assets since 1990. Canto Cumulus is a cross-platform solution that enables companies to easily organize, find, share and track their ever-increasing numbers of digital files, in any format. Canto’s worldwide network of certified developers offers an impressive assortment of plug-ins that enhance the Cumulus product line further. Learn more: www.canto.com
Canto, the Canto logo and Cumulus are registered trademarks of Canto. Other company and product names might be trademarks of their respective owners. Some product claims and features are not included in all versions of the software and/or might require additional Cumulus Add-ons or Plug-ins. C|TIP/FormulasForLabels/V1.0/07.2009
Copyright ©2009 Canto GmbH. All rights reserved. www.canto.com
Page 2 of 2