Create list of specific data type

Create list of specific data type

Table of Contents

Note: This task is applicable only to Zoho Creator.

Overview

Create list variables which hold elements of a particular data type only.

Syntax

To declare a string list variable

<variable> = List:String();

To declare a Bigint list variable

<variable> = List:Int();

To declare a Decimal list variable

<variable> = List:Float();

To declare a Timestamp list variable

<variable> = List:date();

To declare a Boolean list variable

<variable> = List:Bool();
ParameterDescription
<variable>

Variable which will hold the list elements.

Points to keep in mind for each type of list

Data type of the list       Points to keep in mind
Text

Text elements must be enclosed in single or double quotes. 

Number and Decimal elements can be specified without the quotes, which will be converted into text data-type by default.

Date-time elements must be enclosed in single quotes, which will be converted into text data-type by default.

Boolean values must be specified with or without single/double quotes, which will be converted into text data-type by default.

Number

Only whole numbers must be specified with or without single/double quotes.

If any other data-type is specified, an error will displayed during runtime.

Date-time

Date-time values must be specified in single or double quotes.

You can specify numbers without quotes, where the number 1 stands for the date-time value 31-Dec-1969 16:00:00, and every increase in 1000 will add 1 second to the date-time value, and every decrease in 1000 will subtract 1 second from the date-time value. So, the number 1000 will return a date-time value of 31-Dec-1969 16:00:01.

Specifying number or text elements in single/double quotes will return an error during run-time.

If the time value is not specified, 00:00:00 will be set as the time value by default.

You can specify any valid date-time format, which will get converted into the format selected in application settings.

Boolean  

You must only specify Boolean values 'True' or 'False' with or without single/double quotes.

Any other value within quotes will display an error during runtime.

Decimal  

You can specify numeric values with or without single/double quotes.

Date-time values can be specified in single quotes, which will get converted into the equivalent numerical value. The date-time value 31-Dec-1969 16:00:00 stands for the number 1, and every increase in 1 second will add 1000 to the number, and every decrease in 1 second will subtract 1000 from the number. So, the date-time value of 31-Dec-1969 16:00:01 will return the number 1000. 

If any other data-type is specified, an error will displayed during runtime.

This task can be used in the following events

When a record is Created
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Created or Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Edited
On LoadYes
On ValidateYes
On SuccessYes
On User inputYes
Subform on add rowYes
Subform on delete rowYes
When a record is Deleted
On ValidateYes
On SuccessYes
Other workflow events
On a scheduled dateYes
During approval processYes
During payment processYes
In a Custom FunctionYes
In an Action item in reportYes

Examples

1) The following sample snippet adds the equivalent numerical value of the specified date to the list:

var = List:float();
var.add('1-Jan-2019');     // adds 1546329600000

2) The following sample snippet adds the number '1' as a string value to the list.

listVar=list:String();
listVar.add(1);

Share this post : FacebookTwitter

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

Write to us: support@zohodeluge.com