Changes

Jump to: navigation, search

Expressions

6,556 bytes added, 20:09, 20 November 2019
no edit summary
==== POWER function ====
 
Returns the power of a value in a defined exponent. It can be used with only one parameter, in this case it considers the default exponent 2. If a second parameter is passed, this will be the exponent.
 
Syntax:
POW(<expression>; <exponent>)
Examples:
POW("Profit")
POW("Cost"; 3)
 
 
==== RANDOM function ====
 
Returns a random number within the range of values ​​passed as arguments.
 
Syntax:
RANDOM(<start limit>; <end limit>)
Example:
RANDOM(10,100)
 
 
==== SQRT function (Square Root) ====
 
Returns the square root of a value.
 
Syntax:
SQRT(<value or expression>)
Examples:
SQRT("Profit")
SQRT(81)
 
 
==== LIKE function ====
 
Returns true if the desired content is found in the list and false otherwise. It needs two parameters, the first is the data to query and the second is the term to be found. Remembering that it is necessary to use the wildcard operator “%” and surround the term by single quotation mark.
 
Syntax:
LIKE(< data>; <term>)
Example:
LKE("Product"; '%anh%')
 
 
== Date Functions ==
 
Date functions are operations that take a date as a parameter and also return a date. There are some constants to assist in using date functions, they are:
 
* 0: ''DATE_FIELD_YEAR'' (Part of the year)
* 1: ''DATE_FIELD_MONTH'' (Month Part)
* 2: ''DATE_FIELD_DAY'' (Daypart)
* 3: ''DATE_FIELD_FORTNIGHT'' (Part of fortnight)
* 5: ''DATE_FIELD_WEEK'' (Part of the Week)
 
 
==== DATE_PART function (Date Part) ====
 
Returns part of a date. It needs two parameters, the first is the reference date and the second is the constant that represents which part of the date we want to get.
 
Syntax:
DATE_ PART(<date>; <constant representing which part>)
Example:
DATE_ PART("Issued Date"; 0) - Returns the year portion of the ''Issued Date''
 
 
==== DAY_FROM_TODAY function (Days from today) ====
 
Returns a days count backward (negative) or forward (positive) from today. You need a parameter that indicates the number of days to add or subtract.
 
Syntax:
DAY_FROM_TODAY(<number of days>)
Example:
DAY_FROM_TODAY(-1) - Returns yesterday's date
 
 
==== FIRST_DAY_OF function (First day of) ====
 
Returns the first day of a grouping. This function has two variations:
 
* With two parameters, the first is the grouping constant from which we want to get the first date (see list above), and the second is the base date.
 
Syntax:
FIRST_DAY_OF(<date part>; <base date>)
Examples:
FIRST_DAY_OF(0;DAY_FROM_TODAY(0)) - Returns the first day of the year from today
FIRST_DAY_OF(1;"Issue Date") - First Day of Month Based on ''Issue Date'' Column
 
* With three parameters, the first is the grouping constant from which we want to get the first date (see list above), the second is the date base modifier from today, and the third is the amount to change the modifier.
 
Syntax:
FIRST_DAY_OF(<date part>;<date modifier>;<date modifier value>)
Example:
FIRST_DAY_OF(1,0,-1) - first day of current month of last year
 
 
==== LAST_DAY_OF function (Last day of) ====
 
Returns the last day of a date grouping. This function has two variations.
 
* With two parameters, the first is the grouping constant from which we want the last date (see list above), and the second is the base date.
 
Syntax:
LAST_DAY_OF(<date part>; <base date>)
Examples:
LAST_DAY_OF(0;DAY_FROM_TODAY(0)) - Returns the last day of the year from today.
LAST_DAY_OF(1;"Date Issued") - Last day of month based on ''Date Issued'' column
 
* With three parameters, the first is the grouping constant from which we want the last date (see list above), the second is the date base modifier from today, and the third is the amount to change the modifier.
 
Syntax:
LAST_DAY_OF(<date part>;<date modifier>;<date modifier value>)
Example:
LAST_DAY_OF(1,0,-1) - last day of current month of last year
 
 
==== NEW_DATE function (New date) ====
 
Creates a new date. It needs three parameters, the first corresponds to the day (between 1 and 31), the second month (between 1 and 12) and the third the year. The date is created from year to day, ie the day must be valid for the month and year (considering 29/02, the year must be leap).
 
Syntax:
NEW_DATE(<day>;<month>;<year>)
Example:
NEW_DATE(1;4;DATE_PART("Issued Date";0)) - Creates the first April day of the year determined by the current row in the ''Issued Date'' column.
 
 
==== NUM_OF_DAYS function (Number of days) ====
 
Returns the number of days between two dates. Therefore you need two dates.
 
Syntax:
NUM_OF_DAYS(<date 1>; <date 2>)
Examples:
NUM_OF_DAYS(FIRST_DAY_OF(0;"Issued Date");"Issued Date") - Returns the number of days from the first day of the year, based on the ''Issued Date'' column, to the current day, based on the same column.
NUM_OF_DAYS(FIRST_DAY_OF(1;"Issued Date");LAST_DAY_OF(1,"Issued Date")) - Returns the number of days of the month, based on the ''Issued Date'' column.
 
 
==== NUM_OF_MONTHS function (Number of months) ====
 
Returns the number of months between two dates. Therefore, two date parameters are required.
 
Syntax:
NUM_OF_MONTHS(<date 1>; <date 2>)
Example:
NUM_OF_MONTHS(FIRST_DAY_OF(0; "Date"); "Date") - Returns the number of months between the first day of the year and the current month, based on the ''Date'' column.
 
 
==== PREVIOUS_DATE function (Previous date) ====
 
Given a day and a month, returns the last occurrence of that date. That is, if the current date (today) is less than the date passed by parameter (day / month), the return is the date (passed by parameter) of the previous year. Otherwise the return will be the current year date.
 
Syntax:
PREVIOUS_DATE(<day>; <month>)
Examples:
PREVIOUS_DATE(15;12) - Considering that today's date is 14/11/2019, the last time December 15th occurred relative to today's date was 15/12/2018, so this will be the return.
 
 
== Special Variables ==
 
They can be used in conjunction with expressions to create complex calculations. Must be used in double quotation marks (“)
 
 
* '''"@count"''' - Total number of rows that were returned for the component.
* '''"@row"''' - Current row number
* '''"@sum[column]"''' - Sum of the indicated column.
** Example: ''"@sum[Price]"'' - returns the sum of all rows in the ''Price'' column.
* '''"@avg[column]"''' - Average column, similar to ''"@sum[column]"'' / ''"@count"''
* '''"@prev[column]"''' - Row value before current row for this column
* '''"@accumCol[column]"''' - Cumulative value from column to current row. Useful for calculating variable mean.
** Example: ''"@accumCol[column]"'' / ''"@row"''
</translate>

Navigation menu