📖
Rulecube documentation
v2.0
v2.0
  • Overview
  • Quick Start
  • Tutorial
    • Getting started
    • Create and Run Your First Ruleset
    • Use Constants and Methods
    • Create and Call Functions
    • Adding Testcases
    • Using Lookup Tables
    • Using Entities
  • How-to Guides
    • Logging in and Authorization
      • Activate Your Account From an Invitation
      • Log in to Rulecube
      • Change Your Password
      • Recover Your Password
      • Two-factor authentication (2FA)
      • Invite Other Users to Rulecube
      • Edit a User's Role
      • Delete a User
    • Ruleset Development
      • Create a Ruleset
      • Set the Input for a Ruleset
      • Create a Rule
      • Generate Alerts
      • Try out a Ruleset
      • Call a Ruleset from Your Software
      • Entities
        • Create an Entity
        • Drag and Drop a JSON Schema or XSD to create entities
        • Advanced topic: Entity instantiation
      • Constants
        • Constant Tables
      • Functions
      • Built-in Functions
      • Create and Run a Testcase
      • Delete a Ruleset or Components
      • Debugging your Ruleset
    • Create a Workflow
      • Workflow step types
      • Working with documents in a workflow
    • Work with (Environment) Variables
    • Call a Ruleset via Its API From Postman
    • Creating input from JSON Schema
    • Use a Ruleset from Your Software
    • Ruleset Productivity Tips
  • Language Reference
    • Global
    • Finance
    • Http
    • Mail
    • MongoDB
    • SQL
    • Statistics
    • Workflow
    • System
    • Array
    • Date
Powered by GitBook
On this page
  1. How-to Guides
  2. Ruleset Development
  3. Entities

Advanced topic: Entity instantiation

A quick explanation of how new instances of entities can be created during execution.

Anywhere in code (functions, rules, calculated properties), you can create new entities on the fly. For instance, when you have an Entity named 'Person', you can create an instance of this and e.g. return this from a Function like this: new Person()

A few examples:

// Inside a Function
let person = new Person();
person.FirstName = "John";
person.LastName = "Doe"
return person;

alternatively:

let person = new Person({ FirstName: "John", "LastName: "Doe"});
return person;

Calculated properties work as expected. Assuming Person has a calculated property named 'FullName' that combines the first and last name properties:

let person = new Person({ FirstName: "John", "LastName: "Doe"});
return person.FullName; // "John Doe"
PreviousDrag and Drop a JSON Schema or XSD to create entitiesNextConstants

Last updated 2 years ago