Formula
The Formula widget empowers users to craft tailored calculations by harnessing JavaScript formulas within their application interface
Specs
Version
1.2.0 (updated on 2024-02-27)
Developer
Labii Inc.
Type
Column
Support Configuration
Yes
Support Readonly view
Yes
Support Edit view
No
Support Form view
No
Support Default value
No
Support Import
No
Allow multiple
Yes
Overview
The Formula widget empowers users to craft tailored calculations by harnessing JavaScript formulas within their application interface. This dynamic tool seamlessly integrates with data from the current record, facilitating precise calculations that reflect specific context. Furthermore, its functionality extends to encompass values sourced from related records via ForeignKey relationships, granting users unparalleled flexibility in constructing comprehensive calculations that span across data sets. Whether crafting intricate financial models or refining data analysis, the Formula widget offers a versatile solution for users seeking to harness the power of custom calculations within their application workflows.
Use case
Calculate the volume left for a sample.
Calculate the detection status for RT-PCR results.
Configuration
To enable the widget's functionality, it requires the provision of options.
Source columns - To define the data source, select one of the ForeignKey, ForeignKeys, or NestedFields columns.
Query - Provide one or more queries for the count value if you wish to use it in the formula.
Formula - Syntax: data[Field 1] + data[Field 2] + count[query name]
Formula fields also support variables.
Execute after - Select the formula columns that need to be executed before this formula is triggered. When a formula is based on a value generated by another formula, this field should be used.
Should auto update - If checked, this widget will perform a live calculation.
Should auto update when empty - If checked, this widget will perform a live calculation when empty.
Example
Use formula to return record name
formula = `return "{{NAME}}"`
Views
See the interface of the widget in the following views.
Readonly view
Readonly view display the values of the column.
Edit view
The Edit view is the interface that allows you to modify the value.
Edit view is not supported for this widget.
Form view
The Form view is the field integrated into the add form for collecting values when creating a new record.
Form view is not supported for this widget.
Data
Each widget in Labii stores data in a unique manner; refer below to understand how data from this widget is stored.
Data format
Any data return from the formula.
Default value
The Default Value field within the column allows you to specify the default value when a record is created.
Default value is not supported for this widget.
Import value
The Import Value is the value you need to include in your Excel table for it to be imported into Labii.
Import value is not supported for this widget.
Last updated