Overview
The Code Editor is available anywhere in Etlworks where users can enter SQL, JavaScript, Python, or XSLT code. It supports full-screen editing, syntax highlighting, integrated macro/function insertion, and other developer-friendly features.
Opening the Code Editor
To launch the editor:
Click Open in Editor above any supported text field.
Or, when supported (e.g., in per-field mapping), click the editor icon directly next to the field.
Editor will open as a popup. You can:
- Click Enter full screen to expand it.
- Click Exit full screen to return to popup mode.
Code Editor Commands and Shortcuts
| # | Shortcut | Command |
|---|---|---|
| 1 | Ctrl+F | Search |
| 2 | Ctrl+Shift+F | Search & Replace |
| 3 | Click Line:Column | Go to Line |
| 4 | Click language selector | Select color highlighter |
| 5 | Click Enter or Exit Full Screen | Enter or exit full-screen mode |
| 6 | Ctrl+Space | Open autocomplete suggestions |
| 7 | ↑ / ↓ | Move through the suggestion list |
| 8 | Enter or Tab | Accept the selected suggestion |
| 9 | Esc | Close the suggestion list |
| 10 | Tab / Shift+Tab | Move between remaining {{parameter}} placeholders in an inserted function template |
Search & Replace
Go to Line
Changing the Language
At the right bottom corner of the Code Editor, you’ll find a language selector. It lists only the languages supported in the current context — for example, JavaScript, Python, SQL, or just one of them.
Changing the selected language:
- Updates the syntax highlighting in the editor
- Signals to Etlworks which execution engine to use
In some cases, like in mapping transformations, switching the language affects how the code is evaluated. For example, if you switch from JavaScript to SQL, the transformation will try to use native SQL on the destination side (if supported) to calculate the column value — instead of running JavaScript inside Etlworks.
This gives you full control over where and how the logic runs.
Context-aware autocomplete
As you write code, the editor suggests identifiers that make sense for what you are editing. Suggestions are tailored to:
- The selected language.
- The current cursor position and any qualifier you have typed.
- The source and destination fields available to the editor.
- Variables and functions declared in the current document.
- The Etlworks functions and macros you are authorized to use.
- The active database connection and SQL query context.
- The specific editor surface you are working in.
Autocomplete never changes your code until you accept a suggestion.
Opening and navigating suggestions
- Press Ctrl+Space at any time to request suggestions. Cmd+Space is also registered where the operating system delivers it, but macOS may reserve it for Spotlight.
- Suggestions may also appear automatically while you type, when Code autocomplete is set to Enabled.
- In SQL, suggestions open automatically after contexts such as SELECT, a comma in the select list, or a qualifier followed by . (for example c.) — when Code autocomplete is set to Enabled.
- In JavaScript and Python, member suggestions open automatically after a . following an object, when Code autocomplete is set to Enabled. In Manual only (Ctrl+Space) mode, press Ctrl+Space instead.
- Use the arrow keys to move through the list, Enter or Tab to accept the highlighted suggestion, and Esc to close the list.
- After you insert a function template, Tab and Shift+Tab move between the remaining {{parameter}} placeholders, and Esc exits placeholder navigation.
- Read-only code viewers (for example log, preview, and result panels) do not provide autocomplete.
Configure autocomplete
Autocomplete is configured per user, in your own profile preferences. It is not an administrator, tenant, or connection setting — your selection is saved to your user profile and applies to the supported code editors for you only.
- Open the user profile menu.
- Open Profile.
- Select Preferences.
- Find Code autocomplete.
- Select one of the available modes.
| Mode | Behavior |
|---|---|
| Enabled | Default. Suggestions can appear automatically while you type, and you can request them explicitly with Ctrl+Space. |
| Manual only (Ctrl+Space) | Suggestions do not open automatically while you type. Pressing Ctrl+Space still opens them. Cmd+Space also works when the operating system delivers it, although macOS may reserve it for Spotlight. |
| Disabled | Autocomplete is completely disabled. Suggestions do not appear while you type, and Ctrl+Space does not open them. Background function, macro, schema, and column metadata discovery for autocomplete is also suppressed. |
Enabled is the default for both existing and new users.
The preference applies immediately to the supported editors:
- the shared Code Editor;
- the Macro Editor;
- Explorer SQL;
- inline SQL editors such as Source Query and Destination Query;
- CLI input.
Keep in mind:
- Disabling autocomplete does not disable editing, syntax highlighting, search, formatting, Code Tools, macros, functions, or execution shortcuts.
- Read-only viewers do not provide autocomplete regardless of the selected mode.
- Manual only (Ctrl+Space) changes only how suggestions are opened. The same context-aware metadata is still available when you press Ctrl+Space.
- Disabled also avoids the background database-metadata requests that are made specifically for autocomplete.
JavaScript/Nashorn
In JavaScript, autocomplete suggests:
- JavaScript keywords and common Nashorn globals.
- Members of JSON, Math, Object, Array, String, Number, Date, and Java. For example, typing JSON. suggests parse and stringify.
- Variables, functions, and parameters declared in the current document.
- Etlworks runtime values such as etlConfig, dataSet, currentRecord, scenario, and value, where they apply to the current execution context.
- Runtime members derived from the Function Builder metadata you are authorized to use.
This is lightweight context discovery. It is not arbitrary Java reflection and not a full JavaScript language server.
Embedded Python
In embedded Python, autocomplete suggests:
- Python keywords and common built-ins.
- Definitions, parameters, assignments, and imports from the current document.
- Members of common modules including json, datetime, math, and re.
- Etlworks runtime values and imported members exposed through the Function Builder metadata you are authorized to use.
This is lightweight context discovery, not full Python type inference.
SQL and database metadata
When a SQL editor has an unambiguous database connection, the editor discovers database objects in the background and suggests them ahead of generic SQL keywords:
- Catalogs, schemas, tables, and views are discovered in the background.
- Available metadata objects are ranked before generic SQL keywords.
- Typing catalog., schema., or table. narrows the suggestions.
- After a table or view is referenced in FROM or JOIN, its columns are loaded asynchronously.
- Table aliases work. For example, with:
SELECT c.
FROM "demo"."dbo"."country" AS ctyping c. suggests columns from country.
- You can keep editing while metadata is loading; an open suggestion list refreshes when the columns arrive.
- Common table expressions (CTEs) and aliases from the current query are suggested.
- Common functions are adapted to the selected connection dialect, including Snowflake, Databricks/Spark, SQL Server/Synapse, PostgreSQL/Greenplum, MySQL, Oracle, BigQuery, and Redshift.
Connection-aware SQL completion is available in:
- Explorer SQL.
- Transformation Source Query.
- Transformation Destination Query.
- Nested-flow SQL loops.
- Other SQL editors when their caller supplies an authoritative connection.
A SQL editor without a clear connection still provides local SQL keywords, CTEs, aliases, and other local suggestions. It does not guess or automatically open a connection.
Functions, macros, and runtime context
The Etlworks functions and macros you are authorized to use appear in autocomplete alongside language suggestions. When you accept a function template:
- The authoritative template is inserted.
- The first unresolved {{parameter}} is selected.
- Tab and Shift+Tab navigate the remaining placeholders.
- Esc exits placeholder navigation.
Security and performance
- Suggestions respect your permissions. Functions, macros, connections, and database metadata you cannot access are not exposed.
- Database metadata is cached and loaded in the background; the editor does not make a database request for every keystroke.
- Setting Code autocomplete to Disabled suppresses the background function, macro, schema, and column metadata discovery performed for autocomplete.
- A failed or slow metadata lookup does not prevent editing.
- Connections configured to disable automatic metadata lookup do not provide automatic schema suggestions.
- This deterministic autocomplete does not send your code or schema metadata to an external AI service.
The suggestion popup
- Each suggestion can show its type and its origin or context.
- Long identifiers get a wider, responsive popup.
- If an identifier is still truncated, hovering over the item shows the full insertion text and its metadata.
- On narrow screens, metadata details may be hidden to preserve room for identifiers.
Availability and limitations
- The strongest context-aware support currently targets JavaScript/Nashorn, embedded Python, and SQL.
- Other selectable languages keep normal editing and syntax highlighting but may not have dedicated semantic catalogs.
- Local-variable and CTE discovery is lexical; it does not replace a full parser or language server.
- Dialect catalogs contain common functions, not every database- or version-specific function.
- Specialized editors may provide a reduced completion context.
- Read-only viewers do not provide autocomplete.
Code Tools: Macros and Functions
The Code Tools panel inside the Code Editor includes two tabs:
- Macros (list of available macro + macro editor)
- Functions (interactive function builder)
To show or hide the Code Tools panel, use the toggle at the bottom of the Code Editor popup.
Macros
A Macro is a reusable fragment of code in SQL, JavaScript, Python, Shell, or other supported languages.
Copying Macro to Editor
Click << button to open Copy Macro menu.
Actions:
- Copy macro: Inserts {{MacroId:Label}} into the script
- Copy body: Inserts raw macro code into the editor
When macro is inserted as a reference it will be displayed as below:
{{MacroId:Label}}When the script is executed, the macro is expanded in place.
Creating a New Macro
1. Click Add Macro
2. Enter:
- Title (display name)
- Label (used in {{MacroId:Label}})
- Code
- Optional: Tags, Description
3. Click Save
Editing or Deleting a Macro
- Click the 🖊️ icon to open the Macro editor.
- Modify or delete the Macro from there.
Searching Macros
You can filter Macros by:
- Name
- Label
- Tags
- Description
Passing Parameters to Macros
Option 1: Use parent-scope variables
var data = 'Some long text';
{{ShortenData:Shorten data}}Where macro code is:
data = data.substring(0, 7) + '...';After expansion:
var data = 'Some long text';
data = data.substring(0, 7) + '...';Option 2: Define reusable functions in macros
Macro:
function shortenString(str, length) {
return (str.length > length) ? str.substring(0, length - 3) + '...' : str;
}Usage:
{{ShortenFn:Shorten function}}
var a = shortenString('Some long text', 10);
var b = shortenString('Another example', 20);Functions
Functions are prebuilt, reusable logic blocks available in all supported languages (JavaScript, SQL, Python, etc.). Unlike Macros, Functions offer a more structured, interactive, and categorized way to discover and insert logic.
The functions you are authorized to use also appear in the editor's context-aware autocomplete. When you accept a function from autocomplete, its authoritative template is inserted, the first unresolved {{parameter}} is selected, and Tab / Shift+Tab move between the remaining placeholders. The interactive Function Builder described below remains available for browsing, filling in parameters, and inserting functions.
Click the Functions tab in the Code Tools panel inside the Code Editor.
You’ll see:
- A Favorites section (only if you have functions marked as favorites)
- A Category selector
- A Search bar
- A list of available functions grouped by category
Selecting Function
Click on a function name to expand it. You’ll see:
- Full description
- Actual code to be inserted
- Optional tags
- A list of input parameters (if the function requires any)
Below that, you’ll see a small form with input fields for each parameter.
You can:
- Enter values for any of the parameters
- Leave them blank (see behavior below)
Then click Copy Function to Editor to insert the function with all current values.
How Parameters Work
Each function can define one or more input parameters. These are placeholders for values like table names, expressions, field names, or format strings.
When inserting a function:
- If you enter a value, it will be used in the generated code.
- If you leave it blank and there is a default value, the default will be used.
- If there is no default and no value entered, the parameter will be included in the code as a placeholder in double curly braces — like {{parameterName}}.
This allows you to insert the function structure now and fill in details later.
Example: let’s say a function has two parameters:
- tableName (no default)
- limit (default: 100)
If you leave both blank, the inserted code will look like:
SELECT * FROM {{tableName}} LIMIT 100;If you enter customers as the table name but leave limit blank:
SELECT * FROM customers LIMIT 100;If you enter both:
SELECT * FROM customers LIMIT 50;Favorites
- Click the ★ icon to add or remove a function from Favorites
- Favorites are stored per browser using localStorage
- If you have favorites, a virtual Favorites category will appear at the top
Filtering and Searching
- Use the Category selector (e.g., Logging, Date & Time, Database Access) to filter the list
- Use the Search bar to filter by:
- Function name