Start Here

This page collects the first steps into one short sequence so you always know what to do and what you should see.

Scripts are indentation-sensitive: blocks under with or where are indented by two spaces. Tiles appear when you use show, and table columns are referenced as Table.Field.

Table of contents

Run Your First Envision Script in the Code Playground

Spin up a fresh playground session and confirm Envision is running by rendering a scalar and a table tile.

  1. Open the Envision Code Playground and start a new session.
  2. Paste the script below and press Run.
  3. You should now see a scalar tile labeled “Session is running” and a table with three rows.
table Greeting = extend.range(3) // 3 lines: N = 1,2,3
Greeting.Step = "Step \{Greeting.N}"
Greeting.Value = Greeting.N * 2

show scalar "Session is running" with count(Greeting.*)
show table "First table" with
  Greeting.Step
  Greeting.Value

If the tiles render, your environment is ready for the rest of the tutorials. Re-run the script after changing Greeting.Value (try Greeting.N^2) to get used to the quick feedback loop.

Load the 1-Echelon 2017 Sample Dataset in the Playground

Use the preloaded playground session for the 1-Echelon 2017 dataset, then run a minimal loader to prove the data is available.

  1. Open the preloaded session or sync the files into /sample as described in the dataset page.
  2. Paste the script below and press Run.
  3. You should now see a scalar with the SKU count and a table showing the last 30 days of orders.
read "/sample/Lokad_Items.tsv" as Items[id] with
  "Id" as id : text
  Name : text
  Category : text
  StockOnHand : number

read "/sample/Lokad_Orders.tsv" as Orders expect [id, date] with
  "Id" as id : text
  "Date" as date : date
  Quantity : number
  NetAmount : number

latestDate = max(date)

show scalar "SKUs loaded" with count(Items.*)

where date >= latestDate - 30
  show table "Orders in the last 30 days" with
    Orders.id
    Orders.date
    Orders.Quantity
    Orders.NetAmount { unit:"$" }

If the table is empty, check that the files live under /sample and the session was created with the preloaded dataset link.

Display a Table Tile and a KPI Tile

Build a tiny dataset inline and surface it as both a KPI (scalar) and a table tile.

  1. Paste the script and run it.
  2. You should now see a KPI showing total revenue and a table listing each SKU.
table Orders[sku] = with
  [| as sku, as Qty, as Price |]
  [| "A-001", 4, 12.5 |]
  [| "B-010", 2, 18.0 |]
  [| "C-003", 6,  9.0 |]

Orders.Amount = Orders.Qty * Orders.Price

show scalar "Total revenue" { unit:"$" } with sum(Orders.Amount)

show table "Order lines" with
  Orders.sku
  Orders.Qty
  Orders.Price { unit:"$" }
  Orders.Amount { unit:"$" }

Change Orders.Price for one item and re-run to see the KPI and table update together.

Plot Weekly Sales with a Line Chart

Create a short date range, add some synthetic sales, and plot the weekly totals to get used to time-aware tiles.

  1. Paste the script and run it.
  2. You should now see a line chart with eight weekly points.
keep span date = [date(2024, 1, 1) .. date(2024, 2, 29)] // 60 days

Day.Sales = random.poisson(20 into Day)
Week.Sales = sum(Day.Sales)

show linechart "Weekly sales" with
  Week.Sales { unit:"units" }

Adjust the date range or the random.poisson parameter and re-run to see how quickly charts update.

Save and Share Your Playground Session

Learn how to keep your progress and hand it to a teammate.

  1. Run the tiny script below so the session has something to save.
  2. Click Save Session to keep your working session.
  3. Click Share, claim a public name (this cannot be edited), and copy the public link.
  4. Open the public link in a new tab to confirm the tiles reappear.
table SessionDemo = extend.range(5)
SessionDemo.Label = "Row \{SessionDemo.N}"

show scalar "Rows ready" with count(SessionDemo.*)
show table "Session snapshot" with SessionDemo.Label

If the link opens with empty tiles, ensure you saved after running the script. Re-run, save again, and re-open to verify.

User Contributed Notes
0 notes + add a note