Tabular IQ

Developer Resources

Developer Home

Language Overview

Tabular IQ scripts are written in standard JavaScript. The engine supports the modern ECMAScript features you’d expect from everyday JavaScript — classes, let and const, template literals, arrow functions, for...of loops, and default parameters — alongside the full scripting API of classes for building forms, working with data, and talking to the host application.

Variables

Use const for values that never change and let for values that do. Both are block-scoped:

const name = "Tabular IQ";
let count = 0;

for (let i = 0; i < 3; ++i)
    count += i;

Template literals make string building painless:

alert(`Hello from ${name} — count is ${count}`);

Declaring a class

Classes are declared with the standard class keyword:

class MyClass
{
}

Once declared, create instances with the new operator:

const a = new MyClass();

Class members

A class body can contain fields and methods. Members of one class don’t conflict with identically named members of another class:

class Counter
{
    // fields, with optional initializers
    count = 0;

    // methods
    increment()
    {
        this.count++;
    }

    report()
    {
        alert(`The count is ${this.count}`);
    }
}

const c = new Counter();
c.increment();
c.report();

Constructors

A method named constructor runs automatically when an instance is created. Constructor parameters come from the new expression:

class Point
{
    constructor(x, y)
    {
        this.x = x;
        this.y = y;
    }
}

const p = new Point(10, 20);

Inheritance

A class can extend another class with the extends keyword. The derived class inherits the base class’s members:

class ChildClass extends ParentClass
{
    constructor()
    {
        alert("child created");
    }
}

This is how most user-interface scripts are structured — your form class extends the built-in Form class and inherits everything a form can do. See Creating a Simple Form.

Calling the base class constructor

Use super(...) to pass parameters through to the base class’s constructor:

class ChildClass extends ParentClass
{
    constructor(input)
    {
        super(input);
    }
}

If a derived constructor doesn’t call super() itself, the base constructor is invoked automatically with no arguments.

Static members

Static methods and fields belong to the class itself rather than to instances:

class Circle
{
    static PI = 3.14159;

    static area(radius)
    {
        return Circle.PI * radius * radius;
    }
}

alert(Circle.area(2));

Functions

Standard function declarations, function expressions, arrow functions, and default parameters are all available:

function greet(name = "world")
{
    return `Hello, ${name}`;
}

const double = x => x * 2;

alert(greet());       // Hello, world
alert(double(21));    // 42

A note on legacy syntax

Scripts written for earlier versions used an older class notation, with a constructor named after the class and the function keyword before each method:

// legacy notation -- still runs, but don't use it in new code
class MyClass
{
    function MyClass()
    {
    }

    function myMethod()
    {
    }
}

That notation continues to work — existing scripts don’t need to be changed — but new scripts should use the standard ECMAScript syntax shown throughout these guides.

Next steps