Browse Source

Document enum formula results

pull/25998/head
SALİH ÖZKARA 3 days ago
parent
commit
bf4e406173
  1. 11
      docs/en/low-code/expression-language.md
  2. 10
      docs/en/low-code/formula-properties.md

11
docs/en/low-code/expression-language.md

@ -45,6 +45,16 @@ If(CustomerId.IsPreferred, Amount * 90%, Amount)
Related paths may also contain quoted identifiers. The Designer loads the available fields for each relationship level and applies the backend's configured maximum traversal depth. Missing related values produce a blank result where the expression is nullable.
### Enum values
Use `EnumType.Value` to return an enum value from a formula. For example, if `InvoiceCount` is a rollup property:
```text
If(InvoiceCount > 0, CustomerType.Customer, CustomerType.Prospect)
```
The Designer suggests enum types and loads their values after you type the dot. The result is inferred as the referenced enum, so there is no separate enum-type setting. All result branches must use values from the same enum type.
## Operators
| Purpose | Operators and forms |
@ -83,6 +93,7 @@ Mid(ProductCode, 2, 3)
Contains(Name, "pro")
Value(UnitPriceText) * Quantity
DateDiff(StartDate, EndDate)
If(InvoiceCount > 0, CustomerType.Customer, CustomerType.Prospect)
```
`Round` uses midpoint-away-from-zero semantics. `RoundDown` rounds toward zero and `RoundUp` rounds away from zero; their decimal-place argument must be a literal from -6 through 6. `Mid` and `Replace` use a one-based start position. `StartsWith`, `EndsWith`, and `Contains` ignore case.

10
docs/en/low-code/formula-properties.md

@ -34,7 +34,13 @@ In the Low-Code Designer:
6. Configure any settings exposed for the inferred type, such as decimal places or currency symbol, then validate again.
7. When the action changes to **Save**, select it to create the property.
The result type is inferred from the expression. Supported property types are String, Int, Long, Decimal, Money, Boolean, Date, and DateTime. Decimal and Money results can also define display precision, and Money results can define a currency symbol.
The result type is inferred from the expression. Supported property types are String, Int, Long, Decimal, Money, Boolean, Date, DateTime, and Enum. Decimal and Money results can also define display precision, and Money results can define a currency symbol.
Use `EnumType.Value` constants to return an enum value. The referenced enum becomes the inferred result type, so no separate enum selection is required. For example, `InvoiceCount` can be a Count rollup property:
```text
If(InvoiceCount > 0, CustomerType.Customer, CustomerType.Prospect)
```
Formula properties may use both JSON-backed and database-mapped scalar fields. Use dot notation to read a scalar field through a foreign key:
@ -43,7 +49,7 @@ CustomerId.CreditLimit
Round(CustomerId.CreditLimit - CurrentBalance, 2)
```
The formula editor offers fields, related fields, local values, and supported functions as suggestions. See the [Low-Code Expression Language](expression-language.md) reference for the complete scalar syntax.
The formula editor offers fields, related fields, enum values, local values, and supported functions as suggestions. See the [Low-Code Expression Language](expression-language.md) reference for the complete scalar syntax.
Client applications cannot set a calculated property. Enable **Server only** when the result must also be omitted from client-facing metadata and responses. A client-visible formula cannot expose a server-only dependency; a server-only formula may use server-only fields.

Loading…
Cancel
Save