Read the WebCenter 14 User Documentation on help.esko.com to learn more about the Button functionality.
Follow these steps to add a Button to your Attribute Category:
- Choose Attributes > Attribute Categories from the main Admin menu.
- Click an existing Attribute Category name to modify it (or add a new one).
- Click the Button icon to add a new Button to your Attribute Category.
The available objects depend on which page the button is used.
|Project attribute edit page||Project attributes|
|Project creation page||Project attributes||Document attributes of documents in the project creation's documents section||Document attributes of documents in the project creation's bill of materials section|
|Document attribute edit page||Document attributes|
In case the document is in more than one project (linked documents), it will return project attributes of the 'first' project, which is quite random, so don't use in this case (unless you are sure the values will be the same anyway).
|Document fold-outs in Task execution page and in Bill of Materials page||Document attributes||Project attributes|
|Task execution page||Task specifications||Project attributes|
att is an associative array containing the values of all attributes or specifications as in the above table. att['attribute 1'] is the value of attribute 1 in the current project or document or task (whichever you are editing).
att['attribute 2'] = att['attribute 1'] + 1 (will set attribute 2 to 21 if attribute 1's value is 20).
- String for text attributes
- Number for integer, float or unit based attributes.
- Date for date/time attributes
When changing the value of an attribute, make sure you give the right type. WebCenter will throw an error if it detects a wrong type.
att['Milestone Date'] = '1 Jan 2015'; (throws an error, expects a Date type but gets a String type)
att['Milestone Date'] = new Date('Jan 1 2015') ; (works fine)
When editing document attributes or task specifications, projatt contains the values of the project attributes.
att['Brand'] = projatt['Brand'] will set the value of the document attribute Brand (or the task specification Brand) to the value of the project attribute Brand.
projatt is read only. You cannot set project attributes from the document attribute edit page or from the task execution page.
docatt is an array of arrays. You get one associative array for each document in the documents section of the project creation.
docatt is the first document. docatt['attribute 1'] is the value of attribute 1 in the fourth document in the documents section.
docatt.length is the number of documents in the documents section.
docatt is read only. You can read document attribute values from the project creation page but you cannot change them.
Works like docatt but for the documents in the Bill of Materials section of the project creation page. If the section does not exist, bomdocatt is not defined or empty.
- docatt starts counting from 0, so does bomdocatt.
- att['Brand'] can also be written as att.Brand. However this does not work anymore if the attribute has spaces and other reserved characters. So always use the notation with .
- Make sure to add sufficient checking to your scripts. You are yourself the first victim of insufficient checking. Your script won't work and you will have no clue why. Check all your assumptions and throw alerts when they are not fulfilled.
- You can empty the value of an attribute by setting it to the empty string. So att['Milestone Date'] = ''; is valid. It will empty the field.
- Multi-value attributes (which are always text based) are delivered with their encoded value. The values are separated with ' | ' (the pipe symbol between 2 spaces). So a multi-value attribute 'Country' with values Belgium and France will be equal to 'Belgium | France'. Make sure when delivering back the values to also correctly encode them.
- After setting the value of an attribute which is part of a cascading drop-down, an attempt is made to execute the cascading. This attempt is not perfect. Since scripting can create lots of different unforeseen situations, the outcome can be somewhat unpredictable.
Validation and error handling
Scripts can be used 'On Save'. This means that the script is executed just before saving the values to the server (and database). An additional object errorObj may be defined by your script and then returned. In case WebCenter gets a non-null object returned by the script, it will fail saving and show a validation error (you remain on your editing page). When returning a non-null object in other places (clicking a button during the session), the error will be displayed as a normal message.
You can put your error message into errorObj.errorMsg
Fill out date attributes
When obtaining the value of a date attribute, you will get a Date object. You can do operations on this object and store it again. To store a value in a date attribute, only a Date object is accepted.
It is a good idea to create a new object from an obtained Date. This way, you will not accidentally overwrite the read attribute when doing operations on the object.
Check format of attribute
It is possible to check the value of an attribute with regular expressions.
You need to add the following attributes in your attribute category: Barcode Type and Barcode.
When clicking the Check Barcode button, your barcode will be checked.