File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,23 @@ Formula fields in ObjectStack allow you to create calculated values using expres
77Formula fields use the ` expression ` property in field definitions:
88
99``` typescript
10+ // Direct subpath import (Style 3)
1011import { Field } from ' @objectstack/spec/data' ;
1112
1213const totalPrice = Field .formula ({
1314 name: ' total_price' ,
1415 label: ' Total Price' ,
1516 expression: ' ROUND(unit_price * quantity, 2)'
1617});
18+
19+ // Alternative: Namespace import (Style 1)
20+ import { Data } from ' @objectstack/spec' ;
21+
22+ const discountedPrice = Data .Field .formula ({
23+ name: ' discounted_price' ,
24+ label: ' Discounted Price' ,
25+ expression: ' IF(quantity > 10, price * 0.9, price)'
26+ });
1727```
1828
1929## Function Categories
You can’t perform that action at this time.
0 commit comments