You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE OR REPLACE NON-PERSISTENT ENTITY Module.MyRootObject (
41
+
stringField: String(0),
42
+
intField: Integer,
43
+
decimalField: Decimal,
44
+
boolField: Boolean DEFAULT false
45
+
);
46
+
47
+
CREATE OR REPLACE NON-PERSISTENT ENTITY Module.MyNestedObject (
48
+
name: String(0),
49
+
code: String(0)
50
+
);
49
51
50
52
CREATE ASSOCIATION Module.MyRootObject_MyNestedObject
51
53
FROMModule.MyRootObject
52
54
TO Module.MyNestedObject;
53
55
```
54
56
55
57
**Rules:**
56
-
- All string fields: bare `String` (no length — unlimited)
58
+
- All string fields: `String(0)` (unlimited). **Do NOT write `String(unlimited)`** — the grammar only accepts number literals. `String(0)` stores as unlimited and DESCRIBE outputs `String(unlimited)`.
57
59
- All number fields: `Integer`, `Decimal`, or `Long` — remove defaults for optional fields
58
60
- Boolean fields **require**`DEFAULT true|false`
59
-
-`NON_PERSISTENT` — these entities are not stored in the database
61
+
-`NON-PERSISTENT` (hyphen) before `ENTITY` — not `(NON_PERSISTENT)` after the name
62
+
- Attributes go inside `(...)` comma-separated with colon separator: `name: Type`
60
63
- One association per parent→child relationship; name it `Parent_Child`
61
64
62
65
---
@@ -145,108 +148,99 @@ Applies an import mapping to a string variable (JSON content) to produce entity
145
148
146
149
```sql
147
150
-- With assignment (non-persistent entities, need the result in the flow)
148
-
$PetResponse= IMPORT FROM MAPPING Module.IMM_Pet($JsonContent);
151
+
$OrderResponse= IMPORT FROM MAPPING Module.IMM_Order($JsonContent);
149
152
150
153
-- Without assignment (persistent entities, just stores to DB)
151
-
IMPORT FROM MAPPING Module.IMM_Pet($JsonContent);
154
+
IMPORT FROM MAPPING Module.IMM_Order($JsonContent);
152
155
```
153
156
154
157
### Export to mapping
155
158
156
159
Applies an export mapping to an entity object to produce a JSON string:
157
160
158
161
```sql
159
-
$JsonOutput = EXPORT TO MAPPING Module.EMM_Pet($PetResponse);
162
+
$JsonOutput = EXPORT TO MAPPING Module.EMM_Order($OrderResponse);
SNIPPET'{"translation":{"identifier":"web","name":"World English Bible","language":"English","language_code":"eng","license":"Public Domain"},"random_verse":{"book_id":"1SA","book":"1 Samuel","chapter":17,"verse":49,"text":"David put his hand in his bag, took a stone, and slung it."}}';
RETRIEVE $MyApiItem FROM $MyApiResponse/MyModule.MyApiResponse_MyApiItem;
244
233
@position(565, 200)
245
-
LOG INFO NODE 'Integration''Retrieved Bible verse' WITH ();
234
+
LOG INFO NODE 'Integration''Status={1} Code={2} Count={3}'
235
+
WITH ({1} = $MyApiResponse/ApiStatus,
236
+
{2} = $MyApiItem/Code,
237
+
{3} = toString($MyApiItem/Count));
246
238
END;
247
239
/
248
240
```
249
241
242
+
> **Note on association retrieve:**`RETRIEVE $Child FROM $Parent/Module.Assoc` on a Reference-type association traversed forward (from FK-owner to referenced entity) returns a **single entity**, not a list. `LIMIT 1` is redundant and will be dropped from the BSON roundtrip.
243
+
250
244
---
251
245
252
246
## Gotchas and Common Errors
@@ -259,6 +253,9 @@ END;
259
253
| Studio Pro shows "List of X" but mapping returns single X |`ForceSingleOccurrence` not set | Executor auto-detects from JSON structure root element type |
260
254
| StartEvent behind first activities | Default posX=200 vs @position(-5,...) | Fixed: executor pre-scans for first @position and shifts StartEvent left |
0 commit comments