Deluge Data types

Deluge Data Types

Deluge supports the following data types:

  • String

    The string datatype represents a sequence of characters. These characters can be text characters, special characters, numeric characters or any other valid input. The specified input must be enclosed in double quotes.

    Declaring a string variable

    1) Name = "John";

    2) Address = "Zoho Corporation, 4141 Hacienda Drive, Pleasanton, California 94588, USA";

  • Bigint

    The bigint datatype represents integer values. These integer values can range from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Bigint datatype does not include decimal values. However, bigint datatype can be used to perform operations with decimal values, in which case the end result becomes a decimal datatype.

    Declaring a bigint variable

    1) phone_number = 8778344428;

    2) floor = -2;

    3) temperature = 0;

  • Decimal

    The Decimal data type represents decimal values. It is most commonly used to represent values such as currency, percentage, etc.

    Declaring a decimal variable

    1) price = 99.5;

    2) marks_percent = 99.8;

  • Timestamp

    The Timestamp datatype represents date and time values in any format that is supported by Zoho Creator. Date and time values must be enclosed within single quotes. Date value can be declared individually but time value must be accompanied with a date value.

    Declaring a timestamp variable

    1) date = '15-Aug-1947';

    2) Appointment_time = '15-Aug-1947 19:00:00';

    Note:

    • Date and Time values must be enclosed within single quotes.
  • Boolean 

    The Boolean datatype represents the boolean values - true and false.

    Declaring a boolean data type

    1) Job_Experience = false;

    2) Salary_Negotiable = true;

    Note:

    • Boolean values must not be enclosed in quotes.
  • List

    The List datatype represents an array of elements stored together. These elements can be of string, bigint, boolean, and map datatypes. 

    Elements in a list can be subject to various operations such as:

    • Positional Access - Manipulate elements based on their numerical positional in the list. For example, functions such as contains(), get(), and remove().
    • Search - Search for elements in a list and return their numeric position. For example functions like indexOf(), lastIndexOf().
    • Range - Perform range operations like sublist().
    • Unique functions - Perform unique functions like intersect(), sort(), etc.

    Declaring a list variable

    1) games_list = {"baseball", "football"};

    2) marks_list = {95, 98, 99};

    3) decision_options = [true, false];

    Note:

    • The list of elements must be enclosed in curly({ }) or square([ ]) brackets.
  • Map

    Using Map data type, you can store a value based on a key. It cannot have duplicate unique keys. Once stored, you can then use the key to retrieve the value at a later date.Keys must be of string or bigint data type. Values can be of any data type.

    Key Value pairs in a map can be subject to various operations like:

    • Key value Pair Operations - Perform actions based on the key value pair. For example, functions such as put(), get() and putAll().
    • Search - Search for key or value in a map and return a boolean value. For example, functions such as containKey() and containValue().
    • Range - Perform range operations to return all the keys in the map. For example, keys().
    • Unique functions - Perform unique functions like size() to return the size of the map.

    Declaring a map variable

    1) fruits_color = {"apple":"red", "banana":"yellow", "grapes":"green" };

    Note:

    • The Map elements must be enclosed in curly ({}) brackets.
  • Collection

    Collection is a data-type which can hold list or map values.

    Declaring a collection variable

    // collection variable to store key-value pairs
    product_details = Collection("company":"Zoho", "Product":"Creator");

    // collection variable to store elements
    products = Collection("Mail", "Creator");

    List/Map vs Collection

    When a variable is declared as a list data type or a map data type, it can only hold values that are applicable to that particular data type. For example, a list variable can only hold elements, and a map variable can only hold key-value pairs.

    However, both list and map data types are fundamentally a collection of values, in the sense that, a list data type holds a collection of elements, and a map data type holds a collection of key-value pairs. Consequently, there are built-in functions that are common to both the data types, but are maintained as two different sets of functions. For example, the put() map function is used to insert a key-value pair in a map variable, and the add() list function is used to insert an element in a list variable.

    To make things easier, we have come up with the "collection" data type, where one can simply declare a collection variable, and use it to store either list elements or key-value pairs. Note that each collection variable at a time can act only as a list variable containing elements, or as a map variable containing key-value pairs. It cannot contain elements and key-value pairs together in a single collection. We also have a set of built-in functions relevant to the collection data type, which can be applied to the collection variable irrespective of it holding list values or map values. For example, the insert() collection function can be used to insert a key-value pair or an element, depending on the collection variable holding key-value pairs or elements.

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohocreator.com