The data lookup button allows users to populate attribute values from an external source, for example, a PIM (Product Information Management) or Collections Managment system. We can also work with clients to develop a plug-in providing custom lookup functionality, for example to look up data from a Web Service provided by your IT team – please contact us if you want to discuss this option.
The rest of this help page covers using a simple plug-in that looks up data from a tab-delimited text file located on your Asset Bank server. We are happy to provide consultancy to help you configure this – please note that this work would be chargeable i.e. it is not included in our standard support.
The following settings are available when creating and editing the attribute:
- Label - Text to display on the button itself.
- Help text - Help text available next to the data lookup button.
- Plugin class - The name of the class that performs the data lookup. To read from a tab-delimited text file, use the value com.bright.assetbank.attribute.plugin.DataLookupFromTextFilePlugin.
- Attributes for parameters (comma separated) - The ids of attributes which are used to lookup rows in the text file. The ID of an attribute can be found by looking at the URL for editing the attribute on the Attributes page of the Admin section. The id for an attribute follows the 'attributeId=' part of the URL. For example, if you want to use the Title as the lookup value, then the setting is 3. If you want to use the ID of the asset and its Original Filename (comma separated within the same lookup column, e.g. "10,image.png") then the setting is 2,6.
In addition to these settings, the textfile-path setting in the DataLookupFromTextFileSettings.properties (in the WEB-INF/classes folder) file must point to the tab-delimited file located on the server. (Note, you may have to create this text file if it does not yet exist.) For example, the contents of this file could simply be "textfile-path=/var/lib/tomcat/webapps/asset-bank/WEB-INF/classes/DataLookupFile.txt". Please note that the path must be absolute. It is also worth considering whether this file should be accessed remotely, for example by FTP or SCP, so that it can be updated regularly.
An example file looks like this:
Title Description Keywords
Lookup title New description New keywords
If the 'Attributes for parameters' setting is 3 and an asset has the title "Lookup title", then clicking the data lookup button will result in the description changing to "New description" and the keywords to "New keywords".
Note that any columns where the header name does not match the label of an attribute are ignored.
The columns can also be in any order unless more than one attribute is used for the ‘Attributes for parameters’ field. In this case, the column containing the lookup values for the attribute must be the first.