There are numerous ways you can make using the Libraries easier, and Calculation fields are definitely one of them. Use the predefined functions and data in other fields from your entries to accomplish basic calculations on the spot. This will help the end-user arrange the data, and minimize the time spent to fill the entries.
To set the automated computation, make sure to add the Calculation field while Creating or Editing the Library. Once chosen, you need to:
- set the Field name
- create an Expression
- add the Field(s) that will participate in it. You will see the available fields from the current Library, along with the type of field indicated near them
- add the Function that will perform the calculation. No worries, you don’t need to write the Function from scratch, we have added some templates you can use and divided them into the categories: Math, Date/Time, Strings, Logical. Each function has a brief description that will help you figure out if it covers your needs.
- choose how to Display this field
- adjust Advanced parameters: Result type (Real, Integer, Date, Date/Time or String result) will depend on the Expression you create; Scale; add Dependencies
After fulfilling the required information, press Create to add a new field. Save the changes in the Library.
Let me provide an example. Let’s say you have a Library that includes the information about your colleagues, and you have their birthdays in one of the fields. To calculate their age, you can add the Calculation field, and create the following expression:
relativeTimeStr(#{birthday})
Where #{birthday} is the existing field where you enter the date of birth. Set Result type to String result, and you’re good to go!
More detailed information can be found on the wiki.