-
Notifications
You must be signed in to change notification settings - Fork 36
HowToCalculatedField
Carlo Barazzetta edited this page Jan 27, 2017
·
1 revision
Please refer to here for general information about models.
Kitto allows you to define fields as the result of a SQL expression calculated on the fly. These fields do not exist in the underlying database table but are needed in the application.
Use the Expression
node: expressions may contain macros, and particularly database-scope macros (those with a DB. prefix) to help writing database-independent code. Fields must be qualified using the standard {Q} qualifier.
Example from TasKitto
# model Activity.yaml
ModelName: ACTIVITY
...
Fields:
....
START_TIME: Time
END_TIME: Time
DURATION: Float
DisplayWidth: 8
Expression: |
case
when ({Q}START_TIME is null) or ({Q}END_TIME is null) then 0
else ({Q}END_TIME - {Q}START_TIME) / 3600
end
- Kitto at a glance
- Getting started
- Setup
-
Basic concepts
- Basic Materials
- Controllers
- Features
- Kitto Enterprise
- Examples
- Developer's guide
- Library reference
- Frequently Asked Questions
- Kitto tips & tricks and how-tos
- Other information