Open main menu

TaticView β

Changes

Expressions

65 bytes added, 18:24, 3 June 2013
no edit summary
The arithmetic expressions relate two operands (value or another expression) to compose a sum, subtraction, multiplication or division.
==== Sum (+) ====
Sum two operands. Represented by the sum (+) character.
Syntax: ''<operand/expression> + <operand/expression>''.
'''Examples''': "Taxes" + "Commissions";
==== Subtraction (-) ====
Subtract two operands. Represented by the subtract or hyphen (-) character.
Syntax: ''<operand/expression> - <operand/expression>''.
'''Examples''': "Gross Sale" - "Taxes";
==== Multiplication (*) ====
Multiplicate two operands. Represented by the multiplication or star (*) character.
Syntax: ''<operand/expression> * <operand/expression>''.
'''Examples''': "Amount" * "Unit Price";
==== Division(/) ====
Divides two operands. Represented by the divide or bar (/) character.
Syntax: ''<operand/expression> / <operand/expression>''.
The relational expressions compare two operands (value or another expression) two evaluate if a condition is ''true'' or ''false''. Usually used with decision functions, like the ''IF''.
==== Equal (==) ====
Performs the equal comparison expression between two operands. Represented by the equal operator (==).
Syntax: ''<expression> == <expression>''.
'''Examples''': "Unit Price" == "Total Price";
==== Different (!=) ====
Performs the different comparison expression between two operands. Represented by the different operator (!=).
Syntax: ''<expression> != <expression>''.
'''Examples''': "City.City" != 'New York';
==== Greater than (>) ====
Return ''true'' if the the first expression is greater than the second expression and ''false'' otherwise. Represented by the greater operator (>).
Syntax: ''<expression> > <expression>''.
'''Examples''': "Order Date" > '01/01/2011';
==== Greater or equal than (>=) ====
Return ''true'' if the the first expression is greater than or equal to the second expression and ''false'' otherwise. Represented by the greater or equal operator (>=).
Syntax: ''<expression> >= <expression>''.
'''Examples''': IF("Order Date" >= '01/01/2011';"Order Date";0);
==== Lesser than (<) ====
Return ''true'' if the the first expression is lesser than the second expression and ''false'' otherwise. Represented by the lesser operator (<).
Syntax: ''<expression> < <expression>''.
'''Examples''': "Profit" < '0';
==== Lesser or equal than (<=) ====
Return ''true'' if the the first expression is lesser than or equal to the second expression and ''false'' otherwise. Represented by the lesser or equal operator (<=).
Syntax: ''<expression> <= <expression>''.
==== And (&&) ====
Performs the logical operation ''AND'' between two boolean values. The two operands must be ''true'' for the result of the operation to be ''true''. Represented by the ''AND'' operator (&&).
Syntax: ''<expression> && <expression>''.
'''Examples''': IF((Gross Sales > '0') && (Seller == 'John Snow');'Sold';'Not Sold'), IF((City!="#null") && (Date<DAY_FROM_TODAY(0));1;0);
==== Or (||) ====
Performs the logical operation ''OR'' between two boolean values. One of the two operands must be ''true'' for the result of the operation to be ''true''. Represented by the ''OR'' operator (||).
Syntax: ''<expression> || <expression>''.
'''Examples''': IF((Gross Sales > '0') || (Sold == 'true');'Sold';'Not Sold'), IF((City!="#null") || (Date<DAY_FROM_TODAY(0));1;0);
==== Not (!) ====
Performs the denial logical operation for a boolean value. If the operand are ''true'' the ''NOT'' convert it to ''false'' (and the other way around). Represented by the ''NOT'' operator (!).
Syntax: ''! <expression>''.
The basic functions are system default functions and implements useful functionalities.
==== Abs ====
Returns the absolute value of a base value.
Syntax: ''ABS(<expression>)''. Accept one parameter and process a numeric data type.
'''Examples''': ABS(Gross Sale-Taxes);
==== Avg ====
Returns the average value of an array of values.
Syntax: ''AVG(<expression1>;<expression2>[;<expression3>;...;<expressionN>])''. Accept multiple parameter and process a numeric data type.
'''Examples''': AVG(Taxes;Commissions;Costs);
==== Between ====
Check if a value is inside the boundaries of the parameters values.
Syntax: ''BETWEEN(<expression_to_test>;<expression_bottom_limit>;<expression_top_limit>)''. Need three parameters (of any data type, but
'''Examples''': BETWEEN("Date";'01/01/2013';'31/12/2013'), BETWEEN("Gross Sales";'0';'1000.00');
==== If then else ====
Tests a boolean expression and returns a value in case it is ''true'' and another in case it is ''false''.
Syntax: ''IF(<expression_test>;<expression_for_true>;<expression_for_false>)''. Need three parameters, a boolean for test and returns any
'''Examples''': IF("Branch"=='SOUTH';'South';'Other Branch'), IF("Profit"==0;0;Profit+Taxes);
==== Log ====
Returns the log value of a number on a set base.
Syntax: ''LOG(<expression_number>[;<expression_base>])''. Minimum one parameter and maximum two. If just one parameters is given, the
'''Examples''': LOG(Profit);
==== Max ====
Returns the greater value between two numbers.
Syntax: ''MAX(<expression_value1>;<expression_value2>)''. Need two value parameters and returns a value data type.
'''Examples''': "Total Value"/MAX("Quantity";"1");
==== Min ====
Returns the smaller value between two numbers.
Syntax: ''MIN(<expression_value1>;<expression_value2>)''. Need two value parameters and returns a value data type.
'''Examples''': "Total Value"/MIN("Quantity";"1");
==== Pow ====
Returns the power value of a number on a set exponent.
Syntax: ''POW(<expression_number>[;<expression_exponent>])''. Minimum one parameter and maximum two. If the exponent value is not given,
'''Examples''': POW(Value1)+POW(Value1-Value2;3);
==== Random ====
Returns a aleatory number inside the boundaries of the limit values.
Syntax: ''RANDOM(<expression_bottom_limit>;<expression_top_limit>)''. Need two parameters, the bottom and the upper limit of the random
'''Examples''': RANDOM(0.0;1.0);
==== Sqrt ====
Returns the square root of a value.
Syntax: ''SQRT(<expression>)''. Need one parameters, the value to be calculated.
The date functions are operations that use as parameters and return result of the [[Date|date data type]].
==== Constants list ====
** '''0''': DATE_FIELD_YEAR (Year part);
** '''1''': DATE_FIELD_MONTH (Month part);
==== Date part ====
Return a part of a date.
Syntax: ''DATE_PART(<expression_date>;<constant>)''. Need two parameters, the first is the reference date and the second the constant
'''Examples''': DATE_PART("Order Date";0) - returns the year part of the "Order Date";
==== Day from today ====
Return a backward (negative) or forward (positive) date counting from today.
Syntax: ''DAY_FROM_TODAY(<expression_number_days>)''. Need one parameter, the number of days to add or subtract.
'''Examples''': DAY_FROM_TODAY(-1) - returns the yesterday date;
==== First day of ====
Return the first day of a grouping. This function have two variations:
* '''First way''':
'''Examples''': FIRST_DAY_OF(1;0;-1) - first day of the current month (1) from last year (0;-1);
==== Last day of ====
Return the last day of a grouping. This function have two variations:
* '''First way''':
'''Examples''': LAST_DAY_OF(1;0;-1) - last day of the current month (1) from last year (0;-1);
==== New date ====
Create an object from a day, month and year.
Syntax: ''NEW_DATE(<expression_day>;<expression_month>;<expression_year>)''. Need three parameters, the first is a valid day number (1 to
"Order Date" column;
==== Num of days====
Return the number of days between two dates.
Syntax: ''NUM_OF_DAYS(<expression_date1>;<expression_date2>)''. Need two date data type parameters.
column;
==== Num of months ====
Return the number of months between two dates.
Syntax: ''NUM_OF_MONTHS(<expression_date1>;<expression_date2>)''. Need two date data type parameters.
column and the current month of the "Date" column;
==== Previous date ====
Return the closest exact previous date given a day and month.
Syntax: ''PREVIOUS_DATE(<expression_day>;<expression_month>)''. Need two parameters, the first is the day of month and the second the