{"searchDocs":[{"title":"VTL - Data validation operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/data-validation-operators","content":"VTL - Data validation operators Name\tSymbol\tSupportedCheck datapoint\tcheck_datapoint\t❌ Check hierarchy\tcheck_hierarchy\t❌ Check\tcheck\t❌","keywords":"","version":"Next"},{"title":"VTL - General purpose operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/general-operators","content":"VTL - General purpose operators Name\tSymbol\tSupportedParentheses\t( )\t✔️ Persistent assignment\t&lt;-\t❌ Temporary assignment\t:=\t❌ Membership\t#\t❌ User-defined operator call ❌ Evaluation of an external routine\teval\t❌ Type conversion (string, integer, double, boolean)\tcast\t✔️ Type conversion (others)\tcast\t❌","keywords":"","version":"Next"},{"title":"VTL - Boolean operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/boolean-operators","content":"VTL - Boolean operators Name\tSymbol\tBoolean\tComponent\tDatasetLogical conjunction\tand\t✔️\t❌\t❌ Logical disjunction\tor\t✔️\t❌\t❌ Exclusive disjunction\txor\t✔️\t❌\t❌ Logical negation\tnot\t✔️\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Analytic operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/analytic-operators","content":"VTL - Analytic operators Name\tSymbol\tInMemory\tWebAssemblyAnalytic invocation ❌\t❌ First value\tfirst_value\t✔️\t❌ Last value\tlast_value\t✔️\t❌ Lag\tlag\t❌\t❌ lead\tlead\t❌\t❌ Rank\trank\t❌\t❌ Ratio to report\tratio_to_report\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Join operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/join-operators","content":"VTL - Join operators Name\tSymbol\tInMemory\tWebAssemblyJoin\tinner_join, left_join, full_join, cross_join\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Clause operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/clause-operators","content":"VTL - Clause operators Name\tSymbol\tInMemory\tWebAssemblyFiltering Data Points\tfilter\t❌\t❌ Calculation of a Component\tcalc\t❌\t❌ Aggregation\taggr\t❌\t❌ Maintaining Components\tkeep\t❌\t❌ Removal of Components\tdrop\t❌\t❌ Change of Component name\trename\t❌\t❌ Pivoting\tpivot\t❌\t❌ Unpivoting\tunpivot\t❌\t❌ Subspace\tsub\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Hierarchical aggregation","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/hierarchical-aggregation","content":"VTL - Hierarchical aggregation Name\tSymbol\tInMemory\tWebAssemblyHierarchical roll-up\thierarchy\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Conditional operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/conditional-operators","content":"VTL - Conditional operators Name\tSymbol\tBoolean\tComponent\tDatasetIf Then Else\tif-then-else\t✔️\t❌\t❌ Case\tcase\t❌\t❌\t❌ Nvl\tnvl\t✔️\t❌\t❌","keywords":"","version":"Next"},{"title":"Trevas TS - VTL coverage","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage","content":"Trevas TS - VTL coverage General purpose operators Join operators String operators Numeric operators Comparison operators Boolean operators Time operators Set operators Hierarchical aggregation Aggregate operators Analytic operators Data validation operators Conditional operators Clause operators","keywords":"","version":"Next"},{"title":"VTL - Numeric operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/numeric-operators","content":"VTL - Numeric operators Name\tSymbol\tNumber\tComponent\tDatasetUnary plus\t+\t✔️\t❌\t❌ Unary minus\t-\t✔️\t❌\t❌ Addition\t+\t✔️\t✔️\t✔️ Subtraction\t-\t✔️\t✔️\t✔️ Multiplication\t*\t✔️\t✔️\t✔️ Division\t/\t✔️\t✔️\t✔️ Concatenation\t||\t✔️\t❌\t❌ Modulo\tmod\t✔️\t❌\t❌ Rounding\tround\t✔️\t❌\t❌ Truncation\ttrunc\t✔️\t❌\t❌ Ceiling\tceil\t✔️\t❌\t❌ Floor\tfloor\t✔️\t❌\t❌ Absolute value\tabs\t✔️\t❌\t❌ Exponential\texp\t✔️\t❌\t❌ Natural logarithm\tln\t✔️\t❌\t❌ Power\tpower\t✔️\t❌\t❌ Random\trandom\t✔️\t❌\t❌ Logarithm\tlog\t✔️\t❌\t❌ Square root\tsqrt\t✔️\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - String operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/string-operators","content":"VTL - String operators Name\tSymbol\tString\tComponent\tDatasetString concatenation\t||\t✔️\t❌\t❌ Whitespace removal\ttrim, rtrim, ltrim\t✔️\t❌\t❌ Character case conversion\tupper/lower\t✔️\t❌\t❌ Sub-string extraction\tsubstr\t✔️\t❌\t❌ String pattern replacement\treplace\t✔️\t❌\t❌ String pattern location\tinstr\t✔️\t❌\t❌ String length\tlength\t✔️\t❌\t❌","keywords":"","version":"Next"},{"title":"Developer guide","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/developer-guide","content":"","keywords":"","version":"Next"},{"title":"Import the Trevas TS engine​","type":1,"pageTitle":"Developer guide","url":"/Trevas-TS/docs/developer-guide#import-the-trevas-ts-engine","content":" yarn add @inseefr/trevas   ","version":"Next","tagName":"h3"},{"title":"Call the Trevas TS engine​","type":1,"pageTitle":"Developer guide","url":"/Trevas-TS/docs/developer-guide#call-the-trevas-ts-engine","content":" import { interpret, type Bindings } from 'trevas'; const bindings: Bindings = { sca: 1, DS_1: { dataStructure: [ { name: 'id', type: 'STRING', role: 'IDENTIFIER' }, { name: 'col1', type: 'INTEGER', role: 'MEASURE' }, { name: 'col2', type: 'NUMBER', role: 'MEASURE' }, ], dataPoints: [ ['a', 1, 1.1], ['b', 2, 2.2], ['c', 3, 303.33], ], }, }; const result = interpret('sca + DS_1', bindings);   ","version":"Next","tagName":"h3"},{"title":"WebAssembly mode​","type":1,"pageTitle":"Developer guide","url":"/Trevas-TS/docs/developer-guide#webassembly-mode","content":" See here the dedicated documentation. ","version":"Next","tagName":"h3"},{"title":"VTL - Comparison operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/comparison-operators","content":"VTL - Comparison operators Name\tSymbol\tScalar\tComponent\tDatasetEqual to\t=\t✔️\t❌\t❌ Not equal to\t&lt;&gt;\t✔️\t❌\t❌ Greater than\t&gt;\t✔️\t❌\t❌ Less than\t&lt;\t✔️\t❌\t❌ Greater or equal than\t&gt; =\t✔️\t❌\t❌ Less or equal than\t&lt;=\t✔️\t❌\t❌ Between\tbetween\t✔️\t❌\t❌ Element of\tin / not_in\t✔️\t❌\t❌ Match characters\tmatch_characters\t✔️\t❌\t❌ Is null\tisnull\t✔️\t❌\t❌ Exists in\texists_in\tN/A\tN/A\t❌","keywords":"","version":"Next"},{"title":"VTL - Aggregate operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/aggregate-operators","content":"VTL - Aggregate operators Name\tSymbol\tInMemory\tWebAssemblyAggregate invocation ✔️\t❌ Counting the number of data points\tcount\t✔️\t❌ Minimum value\tmin\t✔️\t❌ Maximum value\tmax\t✔️\t❌ Median value\tmedian\t✔️\t❌ Sum\tsum\t✔️\t❌ Average value\tavg\t✔️\t❌ Population standard deviation\tstddev_pop\t✔️\t❌ Sample standard deviation\tstddev_samp\t✔️\t❌ Population variance\tvar_pop\t✔️\t❌ Sample variance\tvar_samp\t✔️\t❌","keywords":"","version":"Next"},{"title":"VTL - Set operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/set-operators","content":"VTL - Set operators Name\tSymbol\tInMemory\tWebAssemblyUnion\tunion\t❌\t❌ Intersection\tintersect\t❌\t❌ Set difference\tsetdiff\t❌\t❌ Symmetric difference\tsymdiff\t❌\t❌","keywords":"","version":"Next"},{"title":"VTL - Time operators","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/coverage/time-operators","content":"VTL - Time operators Name\tSymbol\tTime_period\tComponent\tDatasetPeriod indicator\tperiod_indicator\t❌\t❌\t❌ Fill time series\tfill_time_series\tN/A\tN/A\t❌ Flow to stock\tflow_to_stock\tN/A\tN/A\t❌ Stock to flow\tstock_to_flow\tN/A\tN/A\t❌ Time shift\ttimeshift\t❌\t❌\t❌ Time aggregation\ttime_agg\tN/A\tN/A\t❌ Actual time\tcurrent_date\t✔️\tN/A\tN/A Subtract dates\tdatediff\t❌\t❌\t❌ Add to date\tdateadd\t❌\t❌\t❌ Year of a date\tyear\t❌\t❌\t❌ Month of a date\tmonth\t❌\t❌\t❌ Number of day within the year\tdayofyear\t❌\t❌\t❌ Number of day within the month\tdayofmonth\t❌\t❌\t❌ Convert days to years\tdaytoyear\t❌\t❌\t❌ Convert days to months\tdaytomonth\t❌\t❌\t❌ Convert duration in days\tyeartoday\t❌\t❌\t❌ Convert duration in months\tyeartomonth\t❌\t❌\t❌","keywords":"","version":"Next"},{"title":"Trevas TS","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/introduction","content":"","keywords":"","version":"Next"},{"title":"What is VTL?​","type":1,"pageTitle":"Trevas TS","url":"/Trevas-TS/docs/introduction#what-is-vtl","content":" Business, logical-level and user-friendly language for statisticiansRelies on standard structural metadataInteroperable, platform-agnosticFunctional language, enabling data lineage for more insight and reproductibility  ","version":"Next","tagName":"h2"},{"title":"Trevas TS​","type":1,"pageTitle":"Trevas TS","url":"/Trevas-TS/docs/introduction#trevas-ts","content":" Trevas TS partially covers the definition of VTL.  Have a look to the coverage section for more information.  ","version":"Next","tagName":"h2"},{"title":"Trevas TS >= 1.0.0​","type":1,"pageTitle":"Trevas TS","url":"/Trevas-TS/docs/introduction#trevas-ts--100","content":" The version of VTL is 2.1.  The library exposes the interpret function, taking 2 arguments, the VTL expression and a bindings object.  BasicScalarTypes, Bindings, Component and Dataset types are also exposed.  For more informations, a developer guide is available.  ","version":"Next","tagName":"h3"},{"title":"Trevas TS < 1.0.0​","type":1,"pageTitle":"Trevas TS","url":"/Trevas-TS/docs/introduction#trevas-ts--100-1","content":" The version of VTL is 2.0.  Versions below version 1.0.0 of Trevas were implemented in JavaScript, using antlr4 and an inconsistent Dataset model.  It is not recommended to use these versions. ","version":"Next","tagName":"h3"},{"title":"WebAssembly mode","type":0,"sectionRef":"#","url":"/Trevas-TS/docs/developer-guide/webassembly-mode","content":"","keywords":"","version":"Next"},{"title":"Import the Trevas TS engine​","type":1,"pageTitle":"WebAssembly mode","url":"/Trevas-TS/docs/developer-guide/webassembly-mode#import-the-trevas-ts-engine","content":" yarn add @inseefr/trevas   ","version":"Next","tagName":"h3"},{"title":"Configure WebAssembly mode and call the Trevas TS engine​","type":1,"pageTitle":"WebAssembly mode","url":"/Trevas-TS/docs/developer-guide/webassembly-mode#configure-webassembly-mode-and-call-the-trevas-ts-engine","content":" By default, Trevas TS engine will run In-memory.  To configure an other implementation, you have to add the key $vtl.engine.processing_engine_names to your bindings.  For WebAssembly mode, the value has to be wasm.  import { interpret, type Bindings } from 'trevas'; const bindings: Bindings = { k: 'v', '$vtl.engine.processing_engine_names': 'wasm', }; const result = interpret('VTL expression', bindings);  ","version":"Next","tagName":"h3"}],"options":{"indexBaseUrl":true,"languages":["en","fr","no"],"id":"default"}}