Create and configure calculated properties

Calculated properties are custom properties whose values are calculated from a formula. The formula can include references to other properties, thereby creating dependencies between your properties. Library administrators can create calculated properties for all property types and in all types of library. 

Examples of use cases:

  • If you have a property named "Price of product", you can create a calculated property named "Value Added Tax" to calculate its VAT automatically when a user enters a value in the "Price of product" property.
  • You can create a calculated property named "Publication date" which records the date when the document is transitioned to "Published" by workflow action. 

This article outlines the basics of calculated properties and how to use the library administration to create and edit them. After getting to grips with the basics in this article, you can learn more: 

Advanced users can get creative and write their own formulas for calculated properties:


In this article:

Calculated properties: the basics
 Create calculated properties
 Edit calculated properties
Known limitations and restrictions

Calculated properties: the basics

The formulas for calculated properties must be written in JavaScript. Each formula can have  a maximum of 2000 characters.

In your formula, you can use:

  • values from the document on which the formula will run:
    • custom property values, for example, the value "Contract" for the property "Type of document"
    • system property values, for example, the document's title or creation date 
    • sequence IDs for the library, document class or document
  • constant values from the library configuration:
    • category values, for example, the value "France" listed in the category "Country" defined at the library level
    • workflow states, for example, "Published" in the "Document publication" workflow

Learn more: Calculated properties: add entity references to your formulas.

When you select AODocs entities to use in your formula in the formula builder, entity references are inserted into the formula. A simplified human-readable form of the syntax is used, which makes it easier to understand and write formulas. AODocs translates the simplified entity references back into the full syntax, which includes the ID of the AODocs entity.

You can see the full syntax when you hover over the formula in the Properties tab:

image02.png

Below is the same formula in the formula builder with simplified entity references:

image01.png


Create calculated properties

Important: Don't combine calculated properties with custom scripts

1. Access the document class settings in the library administration.

2. Follow the procedure to create a new property. In the Create a new property pop-up, activate the switch Calculate the value of this property.

3. Press Write formula.

image01.png

4. Enter a formula in the field. 

In the formula builder, you can select the following elements to use in your formula:

  • Custom properties from the document:
    – in the left panel, select From document > Properties and then press the required type of property, for example, String/Text, Date, Category
    – in the right panel, choose from the properties of the selected type available in your document
  • Sequence IDs from the document:
    – in the left panel, select From document > Sequence ID
    – in the right panel, choose the required sequence ID
  • Category values from the library:
    – in the left panel, select From library > Category values and then press the required category
    – in the right panel, choose from the category values defined at the level of the library 
  • Workflow states from the library
    – in the left panel, select From library > Workflow states
    – in the right panel, choose the required workflow state

Note: System properties can currently only be added manually.

Learn more:

To use properties in your formula, they must already be saved. If you have created one or more properties and haven't yet saved them, they're not available in the formula builder.

image04.png

Tip: Category values defined at the library level don't have simplified entity references. You can hover over the category name in the formula builder to view its ID. This can help you find which values are referenced in the formula!

5. Press Create.

6. Press Save

Notes
– If the syntax of your formula is invalid, you can't save the calculated property and an error message opens. This includes invalid cycle dependencies, for example, if you try to save calculated property 1 that depends on the result of calculated property 2, which itself depends on the result of calculated property 1.
– When a property is calculated, AODocs detects valid dependencies and executes the actions in the correct order.

Learn more about how end users use calculated properties in their documents: Edit custom properties


Edit calculated properties

1. In the document class settings in the library administration, expand a calculated property to display its full information.

Note: Calculated properties can't be mandatory and are always read-only. You can't modify these two fields. However calculated properties can be hidden.

2. Press the pencil button under Formula. The formula builder opens. 

3. Edit your formula and press OK

4. Press Save.

image03.png

Note: If you didn't define a property as calculated when you created it, you can't define it as calculated in the user interface once you have saved it. This can be done only by API. 

Known limitations and restrictions

There are currently some limitations and restrictions to calculated properties:

  • The feature to calculate titles of documents is currently available in private beta only.
    Contact us aodocs-beta@aodocs.com if you’d like to be part of the beta program!
  • Property values are calculated only when a document is saved, not in real time during edit mode.
  • Information about related documents and attachments isn't available in the formula. 
  • Don't combine custom scripts with calculated properties because the order of execution is not guaranteed. This is a permanent restriction.

Note: We’d love to receive your feedback on calculated properties! Create a feature request in our Community.

Was this article helpful? 3 out of 3 found this helpful
If you didn’t find what you were looking for, don’t hesitate to leave a comment!
Have more questions? Submit a request

Comments

2 comments
  • I am on Version 53.21 I am unable to see that feature. Can you direct me where it can be enabled?

    1
    Comment actions Permalink
  • As you were posting this comment our release 54 was rolling out. Your domain should now be in release 54 which includes this new feature.

    0
    Comment actions Permalink

Please sign in to leave a comment.