syntax:types

Any value in EasyMorph can be either number or text or boolean or error. Unlike databases, one column of a table in EasyMorph can hold values of different types, similarly to Excel. Although, keep in mind that most functions expect their arguments to be of certain type.

Numbers are either integer or decimal numbers with fixed decimal point. Floating point numbers are not supported. Effective range is (-7.9 x 10^{28} to 7.9 x 10^{28}) / (10^{0 to 28}) which is 28-29 significant digits with or without decimal point between them.

Examples:

0 -115 100000000.25

Note: In expressions numbers can't be negative (i.e. with single preceding minus). If you need a negative number write it as zero minus something, e.g.

0 - 12.4

instead of

-12.4

To convert text values to numbers see the asnumber function.

Notice that there is no dedicated type for dates in EasyMorph. Instead, as in Excel, dates are numbers, but only formatted as dates. Such number date represents a number of days since January 1st, 1900. For instance 42680 corresponds to November 6th, 2016, because there are 42680 days from January 1st, 1900 to that date.

Dates in expressions can be specified using date literals. A date literal has format #yyyy-MM-dd. For example:

#2016-11-06

is the same as 42680 and corresponds to November 6th, 2016. Here is an example of date literals in a condition:

[Date] >= #2016-10-01 and [Date] <= #2016-12-31

Because dates are numbers, there is no need in using a special function for adding days. To get the next day just add 1. However, there is a special function for adding months — addmonth().

Text is just a text string.

In expressions wrap text strings in quotes. Single and double quotes are equally acceptable. For example:

'Easy' & "Morph"

Note: Ampersand (&) is the text concatenation operator. To convert a value to text see the astext function.

Boolean values can have only two values - TRUE and FALSE. Most often they are a result of a comparison or a logical function.

Error is a special value that indicates incorrect calculation. It can only be a result of an expression. You can check if a value is an error using the iserror function.

You can also create an error values use the error function.

If a table cell has no value - it's the so called *empty value*. You can check if a column value is empty using isempty function. The length of an empty value is always zero.

Empty values are somewhat similar to nulls in relational databases but not exactly. For instance an empty value always equals to another empty value and equals to empty string.

All these comparisons are true:

<empty value> = <empty value> <empty value> = ''

Since in EasyMorph a column can contain values of different types, sorting is also applicable to mixed columns. In case of mixed types the ascending sort order is as follows:

- Empty cells and errors
- Booleans
- Text
- Numbers

Which means that empty cells and errors are less than anything else, booleans are less than text and numbers, text is less than numbers, numbers are greater than any other data type.

syntax/types.txt · Last modified: 2019/11/02 07:45 by dmitry