Skip to content

Commit 319ef34

Browse files
committed
Update calculated-fields.md with new variables and updated screenshots
1 parent 2dc51b7 commit 319ef34

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pages/calculated-fields.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
title: Calculated fields
33
linkTitle: Calculated fields
44
slug: help/calculated-fields
5+
description: Learn how to configure calculated fields in your AppGini app. Calculated fields are read-only fields that get populated automatically with a value calculated from an SQL SELECT query.
6+
keywords: calculated fields, read-only fields, SQL query, MySQL, AppGini, automatic calculations, batch updates, command line
57
---
68

79
# Calculated fields
@@ -65,10 +67,14 @@ In the above query, we're using the special variable `%ID%`. When executing the
6567
* `%USERNAME%` Will be replaced with the currently logged username before executing the query.
6668
* `%GROUPID%` Will be replaced with the group ID of the currently logged username before executing the query.
6769
* `%GROUP%` Will be replaced with the group name of the currently logged username before executing the query.
70+
* `%TABLENAME%` Will be replaced with the name of the table containing the calculated field before executing the query.
71+
* `%PKFIELD%` Will be replaced with the name of the primary key field of the table containing the calculated field before executing the query.
6872

6973
Please make sure to use single quotes around the above variables when using them in queries. You don't have to manually type the variable into the query in AppGini; you can place the cursor at the location where you want to insert the variable, and then click the desired variable at the right as shown in this screenshot:
7074

71-
![](https://cdn.bigprof.com/screencasts/inserting-placeholders-into-queries-for-calculated-fields.png)
75+
![](https://cdn.bigprof.com/screencasts/inserting-placeholders-into-queries-for-calculated-fields-24.12.png)
76+
77+
The above special variables make it easy to write flexible queries that depend on the current user, group, or record. For example, you can use `%USERNAME%` to calculate the total sales made by the currently logged user, or use `%GROUP%` to calculate the total sales made by the group of the currently logged user. `%TABLENAME%` and `%PKFIELD%` can be used to write generic queries that can be copied and pasted to other tables without modification.
7278

7379
## The query helper
7480

0 commit comments

Comments
 (0)