AnyDB References
A reference is a way to address a specific cell in a record or another record. This allows you to create dynamic relationships between records and cells, enabling calculations and data dependencies.
Relative References (inside a Record)
A cell in a record can be connected to another cell in the same record just like how you would connect cells in a spreadsheet. This allows you to create dynamic relationships between cells, enabling calculations and data dependencies.
For example, if you have a cell say (A1) that contains the price of a product and another cell (B1) that contains the quantity of that product, you can connect the two cells to create a formula that calculates the total cost in another cell (C1).
This way, if you change the price or quantity, the total cost in (C1) will automatically update.
To set up a connection between two cells in the same record, you can use the following formula for C1
=A1 * B1
Here's an example of how this looks in AnyDB:
This relative reference is exactly how you would connect cells in a spreadsheet.
Absolute Reference (across Records)
To refer to a cell in another record, you can use an Absolute Reference.
Using absolute references you can connect to other records in the same database or even in different databases or even in different teams (as long as you have access to both the records when setting up the connection).
This allows you to create a dynamic relationship between the two records. This means that if the value in one record changes, the value in the connected record will also change automatically.
To set up an absolute reference, you can use the following syntax:
TEAM ID ! DATABASE ID ! RECORD ID ! CELL ID
These references are separated by !
and include the team ID, database ID, record ID, and the cell ID which allows AnyDB to uniquely identify the cell you are referencing.
Relative References vs Absolute References
- Relative Reference: Refers to a cell in the same record. For example, A1 or B1.
- Absolute Reference: Refers to a cell in another record. For example,
T@TEAM_ID!D@DATABASE_ID!O@RECORD_ID!A1
here's an example of how this looks in AnyDB (a very long set of numbers, but you can see the pattern):
T@6808086b6968594cfc00acee!D@6812cec40ce5e4364a4ecd44!O@6814103b0ce5e4364a4ee1b6!A1
To make working with these references easier, you can copy the absolute cell reference from the cell by right-clicking on the cell and selecting Reference and then selecting "Absolute" option in the menu.
Then simply go to the other record and paste the reference in the cell you want to connect to by typeing = and then pasting the reference string.
As you press enter, the cell will be connected to the other record and you will see the value of the cell in the other record. Now if the value in the other record changes, the value in this record will also change automatically.
Attached Child Record Reference
You can also reference cells in child records that are attached to the current record.
To do this, you can use the following syntax:
C@RECORD_ID ! CELL_ID
Where RECORD_ID
is the ID of the parent record and CELL_ID
is the ID of the cell you want to reference in the child record.
A handy pneumonic to remember this is C@ for Children of a record specified by RECORD_ID.
Instead of having to specify the current record id everytime, you can simply use the handly CURRREC (short for current record) to refer to the current record.
C@CURRREC ! CELL_ID
Limiting the Child Records Reference to a specific template name
By default, the child record reference will return all the child records attached to the current record. If you want to limit the child record reference to specific templates, you can use the following syntax
C@RECORD_ID ! N@ TEMPLATE_NAME ! CELL_ID
Where TEMPLATE_NAME
is the name of the template you want to limit the child record reference to.
This will return only the child records that are attached to the current record and have the specified template name.
Here's an example of how this looks in AnyDB:
C@CURRREC ! N@ Customer ! A1
This will return the value of cell A1 in all child records that are attached to the current record and have the template name Customer.
Note that this will match all templates that have the same name regarless of the version of the template.
Limiting the Child Records Reference to specific template version
To limit the child record reference to a specific template version, you can use the following syntax:
C@RECORD_ID ! E@ TEMPLATE_ID ! CELL_ID
Where TEMPLATE_ID
is the ID of the template you want to limit the child record reference to.
Attached Parent Record Reference
You can also reference cells in parent records that this record is attached to.
To do this, you can use the following syntax:
A@RECORD_ID ! CELL_ID
Where RECORD_ID
is the ID of the parent record and CELL_ID
is the ID of the cell you want to reference in the parent record.
A handy pneumonic to remember this is A@ for Attached To of a record specified by RECORD_ID.
Instead of having to specify the current record id everytime, you can simply use the handly CURRREC (short for current record) to refer to the current record.
A@CURRREC ! CELL_ID
Just like child record references, you can also limit the parent record reference to specific template names or template IDs.
Referring to the current cell
When you are writing a formula in a cell, you can refer to the current cell using the CURRCELL
keyword.
This allows you to create dynamic formulas that depend on the value of the current cell.
For example, if you want to refer to the value of the current cell in a formula, you can use the following syntax:
=CURRCELL > 100 ? 'red' : 'green'
This will return 'red' if the value of the current cell is greater than 100, otherwise it will return 'green' and can be used to set a formula for the background color of a cell. this will dynamically change the background color of the cell based on its value.
Other Record References
You can refer to other data inside a record other than cells by using the following syntax:
Reference Type | Syntax | Description | Example |
---|---|---|---|
Badge | B@BADGE_NAME | Refers to the value of a specific badge. | =B@Priority |
Cell Properties | P@PROP_NAME | Refers to the value of a specific prop of a cell. This can include background color, font size, etc | =A1!P@BACKGROUND_COLOR |
Record Name | M@NAME | Refers to the title of an item in AnyDB. | =M@NAME |
Assigned To | M@ASSIGNED | Refers to the user assigned to the record. | =M@ASSIGNED |
Follow-up Date | M@FOLLOWUP | Refers to the item's follow-up date. | =M@FOLLOWUP |
Status | M@STATUS | Refers to the status (open/closed) of the item. | =M@STATUS |
Template Name | M@TEMPLATENAME | Refers to the template name of this item | =M@TEMPLATENAME |
Template ID | M@TEMPLATEID | Refers to the template ID of this item | =M@TEMPLATEID |