Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoLaval committed Nov 21, 2023
1 parent 7824d8c commit 0177213
Show file tree
Hide file tree
Showing 35 changed files with 1,752 additions and 1,735 deletions.
15 changes: 14 additions & 1 deletion docs/docs/developer-guide/index-developer-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,31 @@ ScriptEngine engine = new ScriptEngineManager().getEngineByName("vtl");

// Add input bindings to engine
Bindings bindings = new SimpleBindings();
InMemoryDataset dataset = new InMemoryDataset(
List.of(
Map.of("var1", "x", "var2", "y", "var3", 5),
Map.of("var1", "xx", "var2", "yy", "var3", 10)
),
Map.of("var1", String.class, "var2", String.class, "var3", Long.class),
Map.of("var1", Role.IDENTIFIER, "var2", Role.ATTRIBUTE, "var3", Role.MEASURE)
);
bindings.put("a", 1);
bindings.put("ds", dataset);
engine.setBindings(b, ScriptContext.ENGINE_SCOPE);

// Execute script
try {
engine.eval("b := a + 1;");
engine.eval("b := a + 1; " +
"ds1 := ds;" +
"ds2 <- ds;");
} catch (VtlScriptException e) {
logger.warn("Eval failed: ", e);
}

// Get result
Long result = (Long) engine.getBindings(ScriptContext.ENGINE_SCOPE).get("b");
Dataset ds1 = (Dataset) engine.getBindings(ScriptContext.ENGINE_SCOPE).get("ds1");
PersistentDataset result = (PersistentDataset) engine.getBindings(ScriptContext.ENGINE_SCOPE).get("ds2");
```

### Execution mode
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/user-guide/coverage/general-operators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ custom_edit_url: null
| Name | Symbol | Supported |
| -------------------------------------------------- | :----- | :----------------: |
| Parentheses | ( ) | :heavy_check_mark: |
| Persistent assignment | <- | :x: |
| Persistent assignment | <- | :heavy_check_mark: |
| Temporary assignment | := | :heavy_check_mark: |
| Membership | # | :heavy_check_mark: |
| User-defined operator call | | :heavy_check_mark: |
Expand Down
Loading

0 comments on commit 0177213

Please sign in to comment.