Ruleset Productivity Tips

Rulecube supports handy keyboard shortcuts that can make your life easier when developing rulesets.

We'll be listing both the Windows and the MacOS shortcuts. Ctrl will be used for Windows users and Cmd for MacOS users.

Saving your ruleset

Ctrl+S / Cmd+S

Like in most other programs, this shortcut will save your ruleset just like clicking the Save button would.

Copying elements

Ctrl+C / Cmd+C

Any element in Rulecube can be copied to your clipboard with this shortcut:

  • Input

  • Entities

    • Entity input

    • Entity calculated properties

  • Constants

  • Functions

  • Rules

  • Tests

This will allow you to:

  • Copy any element from one ruleset to another ruleset

  • Copy (or clone) to the same ruleset

  • Copy input from a ruleset into an Entity's input and vice versa

  • Copy rules from a ruleset into an Entity as a calculated property and vice versa

  • etc.

Cutting elements

Ctrl+X / Cmd+X

This works very much like the Copy command, except this will also delete the original. You can use this to move, for example, a Constant from one ruleset to another.

You aren't obligated to paste it, so this can also just be used as a Delete shortcut.

Pasting elements

Ctrl+V / Cmd+V

Ruleset elements that you have copied or cut can be pasted anywhere with this. This will work across browser tabs and even across browsers. It's even possible to paste the item you've copied in a e-mail or instant message, so someone else can paste it in their ruleset.

Pasting other data

Besides ruleset elements, it's also possible to paste other types of data into your ruleset.

This means that you can copy text from another program and paste this in a ruleset. Rulecube will detect what kind of data this text is and how to parse it. It will let you know how it handled it.

JSON

When your clipboard contains JSON, you will be presented with a dialog upon pasting. You will have the choice to import the JSON as Input properties, Single input property or as Entity.

Try copying and pasting this JSON in a ruleset and see what the different options do:

{
  "FirstName": "John",
  "LastName": "Doe",
  "DateOfBirth": "1990-01-01",
  "FavoriteNumber": 7
}

Note that whatever option you pick, the Types of the properties will be auto-detected. Properties FirstName and LastName will be string, DateOfBirth will be date and FavoriteNumber will be number.

JSON Schema

When your clipboard contains the contents of a JSON Schema file, you will also be presented with a dialog upon pasting it.

A JSON Schema file describes an object in detail and this can be used to create Input and Entities reliably.

This has many advantages over pasting normal JSON, such as including meta-data like descriptions, required fields, enum values, etc.

{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "Subscriber",
    "required": [
        "FirstName",
        "LastName",
        "DateOfBirth"
    ],
    "type": "object",
    "properties": {
        "FirstName": {
            "type": "string",
            "description": "The subscriber's first name."
        },
        "LastName": {
            "type": "string",
            "description": "The subscriber's last name."
        },
        "DateOfBirth": {
            "type": "string",
            "format": "date",
            "description": "The subscriber's birth date."
        },
        "FavoriteNumber": {
            "type": "number",
            "description": "The subscriber's favorite number."
        }
    }
}

The above JSON schema results in a similar model as the one from the JSON example, except that the properties FirstName, LastName and DateOfBirth are marked as Required and additionally, each property has text in their Description fields.

XML

Much like pasting JSON, pasting XML will result in a Input and/or Entities.

<?xml version="1.0" encoding="UTF-8"?>
<Subscriber>
  <FirstName>John</FirstName>
  <LastName>Doe</LastName>
  <DateOfBirth>1990-01-01</DateOfBirth>
  <FavoriteNumber>7</FavoriteNumber>
</Subscriber>

Note: It's recommended to pick the first option in the dialog (as Input Properties) when pasting the above example.

XSD

XSD is a counterpart to XML in the same way that JSON Schema is to JSON.

XSD contains many more descriptors for objects and their possible values.

<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="Subscriber">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="FirstName" type="xs:string" />
        <xs:element name="LastName" type="xs:string" />
        <xs:element name="DateOfBirth" type="xs:date" />
        <xs:element name="FavoriteNumber" type="xs:positiveInteger" minOccurs="0" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

The above XSD results in a similar model as the one from the XML example, except that the properties FirstName, LastName and DateOfBirth are marked as Required

CSV into a Constant table

To do this, make sure you:

  • Currently have a Constant open that is of type Table

  • Have CSV text in your clipboard (i.e. you have copied it)

If you paste, and the CSV data is correct, the constant table will be overwritten with data based on the CSV.

Last updated