Show Menu
Cheatography

Schematiq for beginners Cheat Sheet (DRAFT) by

A list of some of the most commonly used Schematiq add-in functions, to help you get started with Schematiq workbench

This is a draft cheat sheet. It is a work in progress and is not finished yet.

Getting started with text

txt.Split
Splits text: "­A,B­" => "­A" and "­B" (in separate cells)
txt.Join
Joins text: "­A", "­B" and "­C" => "­A,B­,C"
txt.Re­verse
Reverses a text input: "­ABC­" => "­CBA­"
txt.Format
Applies a pattern: txt.Fo­rma­t("Hi {0}", "­Fre­d") => "Hi Fred"
regex.I­sMatch
Tests text against a regex (returns TRUE or FALSE)

Getting started with tables

tbl.Create
Creates a table from data and (optio­nally) headers
tbl.Se­lec­tCo­lumns
Selects only certain columns from a table
tbl.Sort
Sorts a table based on or more columns
tbl.Filter
Filters a table (on a row-by-row basis) based on a filter function
tbl.Ca­lcu­lat­eColumn
Extends the table, adding a new column (calcu­lated row by row)
tbl.Group
Aggregates a table (similar to a SQL 'group by')
tbl.Ge­tValue
Extract exactly one value from a table
tbl.Ge­tValues
Get all values from a table (or those in a specific column) - can be used to return Schematiq data to Excel

Getting started with databases

db.Connect
Connect to a database
tbl.Co­nnect
Connect to a table in the database
tbl.Group (etc)
Behaviour equivalent to in-memory tables
tbl.Do­wnload
Download a full table or query result into memory
db.Query
Execute custom SQL
db.Insert
Insert rows of a Schematiq table into a database table
db.Con­nec­tCustom
Connect using a custom connection string
azTbl.C­on­nec­tCustom (etc)
Connect to Azure Table Storage

Supported data providers

mssql, 'sql server', etc
MS SQL Server
access, msaccess, accdb, mdb
MS Access
hana
SAP HANA
mysql
MySQL
oracle
Oracle
postgr­esql, postgres
PostgreSQL
snowflake
Snowflake
sqlite
SQLite
vertica
HP Vertica
az.~ and azTbl.~
Azure Table Storage
Azure Table Storage is a NoSQL service and is supported through a dedicated group of add-in functions. All other providers use SQL-based connec­tivity.

Advanced table functions

tbl.Pivot
Pivot a table (similar to an Excel pivot table)
tbl.Un­pivot
Unpivot a table (broadly, the reverse of tbl.Pivot)
tbl.Pack
Group a table, creating a column of sub-tables
tbl.Unpack
Unpack a packed table (reverse of tbl.Pack)
tbl.Union
Combine two tables with the same columns
tbl.Join
Perform a SQL-like join (several variants possible)
tbl.Lookup
Search for value(s) and extract a value from that row
tbl.Se­lec­tRows
Select certain rows (numer­ically) from a table
tbl.Up­dat­eCo­lumns
Update many columns using a specified function

Trees and ranges

tree.C­reate
Create a tree from a suitable Excel range
tree.N­ode­Count
Returns the number of nodes in a tree
tree.Union
Combine two trees
tree.G­etV­alues
Returns all values from a tree
tree.Add
Add a new node to a tree (by name/v­alue)
tree.R­emove
Remove a node from a tree (by name)
tree.R­eplace
Replace the value of a named node in a tree
rng.Create
Create a Schematiq range from an Excel range
rng.Se­quence
Create a range of numbers of specific length and 'step'
rng.Subset
Extract a subset of a range
rng.To­pTo­Bottom
Combine two ranges top to bottom
rng.Le­ftT­oRight
Combine two ranges left to right
 

Data processing (CSV, JSON, XML, HTML)

tbl.Ex­por­tDe­limited
Exports a table to CSV format
tbl.Im­por­tDe­limited
Imports a table from CSV (or other delimited) format
tree.E­xpo­rtJson
Exports a tree to JSON format
tree.I­mpo­rtJson
Imports JSON into a tree
tbl.Ex­por­tJson
Exports a table to JSON format
tbl.Im­por­tJson
Imports JSON into a table (JSONPath syntax available)
tree.E­xpo­rtXml
Exports a tree to XML format
tree.I­mpo­rtXml
Imports XML into a tree
tbl.Im­portXml
Imports XML into a table (XPath syntax available)
tbl.Im­por­tHtml
Imports HTML into a table (XPath syntax available)

Web functions

web.Get
Creates a simple GET request
web.Post
Creates a POST request
web.Re­sponse
Executes a web request
web.Cu­sto­mRe­quest
Creates a config­urable web request

File and folder operations

file.L­ist­Files
List all files in a folder (wildcards accepted)
file.L­ist­Folders
List all subfolders in a folder (wildcards accepted)
file.Open
Opens a file for reading
file.Save
Saves a file in a format­-sp­ecific manner
file.O­penText
Opens a file as text for reading
file.S­aveText
Saves a file as text
sq.Save
Saves an object in a custom Schematiq format
sq.Load
Loads an object saved using sq.Save()

User-d­efined functions (UDFs)

fn.Fro­mSn­ippet
Creates a UDF from a snippet, e.g. "(x, y) => x + (2 * y)"
fn.Fro­mTe­mplate
Creates a UDF from a specified Excel range
xl.Load
Loads an Excel workbook into Schematiq memory
fn.Fro­mWo­rkbook
Creates a UDF from an Excel workbook
fn.Call
Executes a UDF
fn.Fix­Input
Fixes the value of a single input to a UDF
fn.Set­Async
Makes a UDF synchr­onous or asynch­ronous

Date and time handling

dt.Offset
Offsets a date (e.g. by a day, business day, week, etc)
dt.Seq­uence
Generates a sequence of dates with required period­icity
dt.Seq­uen­ceB­etween
Generates a sequences between start/end dates or times
dt.Per­iod­sBe­tween
Returns the number of periods in a given interval (e.g. hours in a given day - useful for handling daylight saving!)
dt.Cha­nge­Tim­eZone
Changes a date-time from one IANA time zone to another

Use of dt.Offset

D
Day
B
Business day
W
Week
M
Month
Q
Quarter
S
Commod­ities season (Apr-Sep, Oct-Mar)
Y
Year
H
Hour
'
Minute
"
Second
@
At exactly
+
Move forward
-
Move backwards
<
Move to previous
<=
Move to previous (unless currently at exact)
>
Move to next
>=
Move to next (unless currently at exact)
Operators can be combined, for example -B@18H30' means "the previous business day at 18:30". The same syntax can be used for sequences, for example dt.Seq­uen­ce(­TOD­AY(), 6, "­2M") will generate a year's worth of 2-month intervals.