Changes

Jump to: navigation, search

Expressions

7,532 bytes added, 02:26, 5 October 2022
Marked this version for translation
Expressions allows to manually create and edit [[Filters]] rules by using programming language. <languages/>
'''Important''': After manually editing the expression, the regular operators can not be used until you ''Clear All'' the filters;
<translate>
<!--T:68-->
<div class="index-right">__TOC__</div>
__TOC__<!--T:69-->You can create expressions (formulas) directly in the dashboard components. It can thus display calculated values that are not present in the datasource file/spreadsheet.
== Basic <!--T:70-->To create the expression (formula) in the components, the component must support the addition of the special column ''Expression Structures ==(Formula)''.
=== Value Operands ===<!--T:71-->In TaticView , all columns in the data file can be used in expressions as long as they are also added to the component that will receive the expression.
The value operands are values from a [[Columns Data Type|data type]] that are used in expressions as variables.
<!--T:72-->
In addition, it is also possible to use fixed numbers and texts in the case of comparative expressions.
==== Value type operand ====
Are numeric values of the float type (Real numbers domain). These values allow the use of a integer and a fraction part, separated by the dot (.) character (decimal separator).
'''Examples''': 1, 1.05, 2.55;
==== Text type operand ====Are literal string data operands. These values allow the use of characters chain fields (strings), being delimited by the simple quote (') character. <!--T:73--> '''Examples'''Expression Example: 'John Snow', 'California', 'Spaghetti';
==== Date type operand ====<!--T:74-->Are values that express any date. It is possible to determine a date representing it as a string, being delimited by * If the component has the simple quote (columns ''Total Price'') character and separated by ''Quantity'', you can create an expression to calculate the bar (/) character''Unit Price''. The default supported format is Would be like this:** ''"dd/MM/yyyyTotal Price". ''/ 'Examples'"Quantity"''* In addition, you can use fixed values, such as: ** ''01/01/2011"Total price"', '29/02/2000';10
==== Boolean type operand ====
Are values from the ''true'' or ''false'' kind. Usually used to validate or not a condition.
'''Examples''': true e false;
==== Identifier type operand ====<!--T:75-->Are values We just remember that represents a field or variable in the expression. Used to make reference to data source columns, delimited by double quotes ("). '''Examples''': "City.City", "Productcurrently TaticView only supports expressions whose numeric return.Product";
==== Parenthesis ====
Use to group part of expressions.
'''Examples''': ("Profit" / "Total Price" ) + 10
==== System variable type operand ====Are system pre<!-defined variables. These values are replaced in run-time by preT:225-determined values, delimited by double quotes (") and preceded by star (#). By now only one variable is available: "#null" ->Expressions support the backslash as [[EscapeChar|escape character]] so that indicates null values or fieldsnames can contain the delimiting characters.
<!--T:76-->
Below are details about how the expressions work:
=== Arithmetic Expressions =Basic structure of a Expression (Formula) ==<!--T:77-->
The arithmetic expressions relate two operands (value or another expression) to compose a sum, subtraction, multiplication or division.==== Identifier ==== <!--T:226-->
* '''Sum (+)'''<!--T: Sum two operands. Represented by 227-->It is the name of the field or column involved in the sum (+) character. Syntax: ''<operand/expression> + <operand/expression>'', it must be delimited by double quotes. '''Examples''': "Taxes" + "Commissions";
* '''Subtraction (<!--)'''T: Subtract two operands. Represented by the subtract or hyphen (228-) character. Syntax: ''<operand/expression> - <operand/expression>''. '''* Examples''': "Gross SaleAverage Price". "Screw 1\" philips" - , "TaxesSeler";
* '''Multiplication (*)'''==== Value Operand ==== <!--T: Multiplicate two operands. Represented by the multiplication or star (*) character. Syntax: ''<operand/expression> * <operand/expression78-->''. '''Examples''': "Amount" * "Unit Price";
* '''Division(/)''<!--T:79-->It': Divides two operands. Represented by s the divide or bar (/) characternumerical values. Syntax: ''<operand/expression> / <operand/expression>''You can use both while values and decimal values. '''Examples''': "Total Value" / "Amount"For decimal values, the decimal separator should be the point.
<!--T:80-->
* Examples: 1, 1.05, 2.55
=== Relational Expressions ===<!--T:220-->* Important: Do not use thousand separator in numeric values.
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''.==== Text Operand ==== <!--T:81-->
* '''Equal (==)'<!--T:82-->It'': Performs s the equal comparison expression between two text operands. Represented If you want to use this type of operand in a expression, you must delimit them by the equal operator single quotation mark (=='). Syntax: ''<expression> == <expression>''. '''Examples''': "Unit Price" == "Total Price";
* '''Different (<!=)'''--T: Performs the different comparison expression between two operands. Represented by the different operator (!=). 83--> Syntax* Examples: 'John Snow'<expression> != <expression>, 'California'. '''Examples''': "City.City" != , 'New YorkSpaghetti';
* '''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> >== Date Operand ==== <expression>''. '''Examples'''!--T: IF("Order Date" 84-->= '01/01/2011';"Order Date";0);
* '''Lesser than (<)'''!--T: Return ''true'' if the 85-->These are values that express any date. To represent a date in expressions the first expression behaviour is lesser than similar to text operands, i.e. the second expression and ''false'' otherwise. Represented content must be surrounded by the lesser operator single quotation marks (<'). Syntax: However, the mask ''<expression> < <expression>dd/MM/yyyy''must be used. '''Examples''': "Profit" < '0';
* '''Lesser or equal than (<=)'''!--T: 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 (<=). 86--> Syntax* Examples: '01/01/2019'<expression> <= <expression>, '14/11/2019'. , '''Examples''': IF("Order Date" <= '0125/0112/20112019';"Order Date";0).
=== Logical Expressions =Boolean Operand ==== <!--T:87-->
The logical expressions group two operands (boolean type or another expression) to compose a logic expression, with <!--T:88-->They're operators of the objective to evaluate two boolean operands relation into a ''true'' or ''false'' resulttype. Usually used with decision functionsNormally user to validate, or not, like the ''IF'' and with relational expressionsa condition in a more complex expression.
<!--T:89-->
* Examples: true, false
* '''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= Parentheses ==== <DAY_FROM_TODAY(0));1;0);!--T:90-->
* '''Not (<!)'''--T: Performs the denial logical operation for a boolean value. If the operand are ''true'' the ''NOT'' convert it 91-->Used to ''false'' (group and the other way around). Represented by the ''NOT'' operator (!). Syntax: ''! <separate parts of on expression>''. '''Examples''': IF(!BETWEEN("Date", '01/01/2013', '31/12/2013');'Not 2013';'2013')Expressions within parentheses are processed first.
<!--T:92-->
* Example: ("Profit"/"Total Price") + 10
== Auxiliary Functions ==
=== Basic Functions =System variable Operand ==== <!--T:93-->
The basic functions <!--T:94-->These are predefined variables in the system default functions . To use the system variables you must precede them by hashtag (#) and delimit them by double quotes("). Currently only the "#null" variable is available and implements useful functionalitiesindicates null content.
* '''Abs'''<!--T: Returns the absolute value of a base value. Syntax: ''ABS(<expression95-->)''. Accept one parameter and process a numeric data type. '''Examples'''* Example: ABSIF(Gross Sale-Taxes"Product" == "#null";0;20);
* '''Avg'''== Arithmetic Expressions == <!--T: Returns the average value of an array of values. Syntax: ''AVG(<expression1>;<expression2>[;<expression396-->;...;<expressionN>])''. Accept multiple parameter and process a numeric data type. Can be used to return the average value of different columns from the same row of a table. '''Examples''': AVG(Taxes;Commissions;Costs);
* '''Between'''<!--T: Check if a value is inside the boundaries of the parameters values. 97--> Syntax: ''BETWEENArithmetic expressions relate two operands (<expression_to_test>;<expression_bottom_limit>;<expression_top_limit>)''. Need three parameters (of which can be any data typethe operands described above, but the three must be from or another expression) to make up the same type) and returns a booleansum, ''true'' if value is inside the boundaries and ''false'' if not. '''Examples''': BETWEEN("Date";'01/01/2013';'31/12/2013')subtraction, BETWEEN("Gross Sales";'0';'1000multiplication or division.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
data type, provided that both are from the same type. Useful for logic tests where two different executions expressions are
needed.
'''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==== Sum (+) ==== <expression_number>[;<expression_base!--T:98-->])''. Minimum one parameter and maximum two. If just one parameters is given, the neperian log is returned. If the second parameter is also given, returns the log in the respective base. '''Examples''': LOG(Profit);
* '''Max'''<!--T: Returns the greater value between two numbers. 99--> Syntax: ''MAX(<expression_value1>;<expression_value2>)''. Need Add two value parameters and returns a value data typeoperands or another expression result. Represented by the ''+'Examples''': "Total Value"/MAX("Quantity";"1");charecter.
* <!--T:100-->Syntax: <operating or expression result> '''Min+'''<operating or expression result>Example: Returns the smaller value between two numbers. Syntax: '''"Taxes" + "Commissions"'''MIN(<expression_value1>;<expression_value2>)- Sums the values of the fields ''. Need two value parameters and returns a value data type. Taxes''and 'Examples'Commissions'': "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,
use two (2) by default.
'''Examples''': POW(Value1)+POW(Value1-Value2;3);
* '''Random''': Returns a aleatory number inside the boundaries of the limit values. Syntax: ''RANDOM==== Subtraction (-) ==== <expression_bottom_limit>;<expression_top_limit!--T:101-->)''. Need two parameters, the bottom and the upper limit of the random number to be generated. '''Examples''': RANDOM(0.0;1.0);
* '''Sqrt'''<!--T: Returns the square root of a 102-->Subtract two value. Syntax: ''SQRT(<operands or another expression>)''result. Need one parameters, Represented by the value to be calculated. '''Examples''-': SQRT('36')charecter.
<!--T:103-->
Syntax:
<operating or expression result> '''-''' <operating or expression result>
Example:
'''"Price" - "Taxes"''' - Subtracts the values ​​from the ''Price'' and ''Taxes'' fields.
=== Date Functions ===
The date functions are operations that use as parameters and return result of the [[Date|date data type]].==== Multiplication (*) ==== <!--T:104-->
* '''Date functions constants list:''':** '''0''': DATE_FIELD_YEAR (Year part);** '''1'''<!--T: DATE_FIELD_MONTH (Month part);105-->** '''2''': DATE_FIELD_DAY (Day part);** ''Multiplies two value operands or another expression result. Represented by the multiplication charecter '3''': DATE_FIELD_FORTNIGHT (Fortnight part);** '''5''': DATE_FIELD_WEEK (Week part);.
<!--T:106-->
Syntax:
<operating or expression result> '''*''' <operating or expression result>
Example:
'''"Quantity" * "Unit Price"''' - Multiplies the value of the ''Quantity'' field by the value of the ''Unit Price'' field.
* '''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
representing the desired part date: 0, 1, 2, 3 or 5 (see above constants list).
'''Examples''': DATE_PART("Order Date";0) - returns the year part of the "Order Date";
* '''Day from today''': Return a backward (negative) or forward ==== Division (positive/) date counting from today. Syntax: ''DAY_FROM_TODAY(==== <expression_number_days>)''. Need one parameter, the number of days to add or subtract. '''Examples'''!--T: DAY_FROM_TODAY(107-1) - returns the yesterday date;>
* '''First day of''': Return the first day of a grouping. This function have two variations:** '''First''': Syntax: ''FIRST_DAY_OF(<constant_grouping>;<expression_date>)''. Need two parameters, the first is the constant grouping in which you want to obtain the first date: 0, 1, 2, 3 or 5 (see constants list) and the second is the anchor base date. '''Examples'''!--T: FIRST_DAY_OF(0;DAY_FROM_TODAY(0)) 108- first day of year (0) from today (DAY_FROM_TODAY(0)), FIRST_DAY_OF(1;"Order Date") - first day of month (1) based on the "Order Data";** '''Second''': Syntax: ''FIRST_DAY_OF(<constant_grouping>;<constant_modify_date>;<modify_date_value>)''. Need three parameters, the first is the constant grouping in which you want to obtain the first date: 0, 1, 2, 3 Divide two value operands or 5 (see constants list), the second is the modifier of the base date from today: 0, 1, 2, 3 or 5 (see constants list) and another expression result. Represented by the third is the amount to change the modifier. division charecter ''/'Examples''': FIRST_DAY_OF(1;0;-1) - first day of the current month (1) from last year (0;-1);.
* '''Last day of'''<!--T: Return the last day of a grouping. This function have two variations109-->Syntax:** <operating or expression result> '''First/''': Syntax: ''LAST_DAY_OF(<constant_grouping>;<expression_dateoperating or expression result>)''. Need two parameters, the first is the constant grouping in which you want to obtain the last dateExample: 0, 1, 2, 3 or 5 (see constants list) and the second is the anchor base date. '''Examples''': LAST_DAY_OF(0;DAY_FROM_TODAY(0)) - last day of year (0) from today (DAY_FROM_TODAY(0)), LAST_DAY_OF(1;"Order DatePrice") - last day of month (1) based on the / "Order DataQuantity";** '''Second- Divides the value of the ''Price': Syntax: ''LAST_DAY_OF(<constant_grouping>;<constant_modify_date>;<modify_date_value>)''. Need three parameters, the first is the constant grouping in which you want to obtain the last date: 0, 1, 2, 3 or 5 (see constants list), the second is field by the modifier value of the base date from today: 0, 1, 2, 3 or 5 (see constants list) and the third is the amount to change the modifier. ''Quantity'Examples''': LAST_DAY_OF(1;0;-1) - last day of the current month (1) from last year (0;-1);field.
* '''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
31), the second for a month (1 to 12) and the third is a year. The date is created from year to day, therefore, the day must be
valid for the month and the year (considering 29/02, year must be bissextile).
'''Examples''': NEW_DATE(1;4;DATE_PART("Order Date";0)) - create the first day of april from the year determined by the current row
"Order Date" column;
* '''Num of days''': Return the number of days between two dates. Syntax: ''NUM_OF_DAYS(== Relational Expressions == <expression_date1>;<expression_date2>)''. Need two date data type parameters. '''Examples'''!--T: NUM_OF_DAYS(FIRST_DAY_OF(0;"Order Date");"Order Date") 110- returns the number of days between the first day of year based on the "Order Date" column to the current day of the "Order Date" column, NUM_OF_DAYS(FIRST_DAY_OF(1;"Pay Date"); LAST_DAY_OF(1;"Pay Date")) - returns the number of days of the month of the "Pay Date" column;>
* '''Num of months'''<!--T: Return the number of months between 111-->Relational expressions compare two dates. Syntax: ''NUM_OF_MONTHSoperands (<expression_date1>;<expression_date2>value/text or other expression)''to assess whether a condition is true or false. Need two date data type parameters. Normally used with decision functions, such as ''IF'Examples''': NUM_OF_MONTHS(FIRST_DAY_OF(0;"Date");"Date") - Return the number of months between the first day of the year of the "Date" column and the current month of the "Date" column;.
 ==== Equality (==) ==== <!--T:112--> <!--T:113-->It compares if two operands are the same, returning true if they are the same or false if they are different. Represented by the equality operator ''==''. <!--T:114-->Syntax: <operating or expression result> '''==''' <operating or expression result>Example: '''IF("Product" == "#null";0;20)''' - If the ''Product'' is null, return the value ''0''. Otherwise return the value ''20''  ==== Different (!=) ==== <!--T:115--> <!--T:116-->It compare if two operands are different, returning true if they were different or false if equal. Represented by the differente operator ''!=''. <!--T:117-->Syntax: <operating or expression result> '''!=''' <operating or expression result>Example: '''IF("Product" != 'Lasagna';0;20)''' - If the ''Product'' is different from ''Lasagna'', return the value ''0''. Otherwise return the value ''20''  ==== Greater than (>) ==== <!--T:118--> <!--T:119-->Compares if the first operator (from the left) is greater than the second operator (from the right), returning true if it is greater and false if it is lesser or equal. Represented by the greater operator ''>''. <!--T:120-->Syntax: <operating or expression result> '''>''' <operating or expression result>Example: '''IF("Gross Value" > 1000;1;0)''' - If the ''Gross Value'' is greater than ''1000'', returns the value ''1'', if not the value ''0''  ==== Greater or equal to (>=) ==== <!--T:121--> <!--T:122-->Compares if the first operator (from the left) is greater or equal to the second operator (from the right), returning true if it is greater or equal and false if it is lesser. Represented by the greater or equal operator ''>=''. <!--T:123-->Syntax: <operating or expression result> '''>=''' <operating or expression result>Example: '''IF("Gross Value" >= 2500;100;0)''' - If ''Gross Value'' is greater than or equal to ''2500'' returns ''100'', otherwise returns ''0''  ==== Less than (<) ==== <!--T:124--> <!--T:125-->Compares if teh first operator (from the left) is lesser than the second operator (from the right), returning true if it is lesser and false if it is greater or equal. Represented by the Lesser operator ''<''. <!--T:126-->Syntax: <operating or expression result> '''<''' <operating or expression result>Example: '''IF("Gross Value" < 100;50;200)''' - If ''Gross Value'' is less than ''100'', returns ''50'' if not ''200''  ==== Less or equal to (<=) ==== <!--T:127--> <!--T:128-->Compares if the first operator (from the left) is lesser or equal to the second operator (from the right), returning true if it is lesser or equal and false if it is greater. Represented by the lesser or equal operator ''<=''. <!--T:129-->Syntax: <operating or expression result> '''<=''' <operating or expression result>Example: '''IF("Gross Value" <= 500;100;0)''' - If ''Gross Value'' is less than or equal to ''500'' returns ''100'', if not ''0''  == Logical Expressions == <!--T:130--> <!--T:131-->Logical expressions group together two operands (Boolean or other expression) to make up a logical expression, in order to evaluate the relationship of two Boolean operators to a true or false result. This type of expression is usually used for decision making, such as IF and with relational expressions.  ==== And Operator (&&) ==== <!--T:132--> <!--T:133-->Executes the logical operation ''AND'' between two Boolean values. Both values must return true so that the result of the operation is true. Represented by the ''&&'' operator. <!--T:134-->Syntax: <expression> && <expression>Examples: '''IF(("Price" > 0) && ("Seller" == 'John Snow');450;0)''' - If ''Price'' is greater than ''0'' '''AND''' ''Seller'' is equal to ''John Snow'', returns ''450'' if not returns ''0'' '''IF(("City" != "#null") && ("Product" != 'Lasagna');1;0)''' - If ''City'' is non-null '''AND''' ''Product'' is different from ''Lasagna'' returns ''1'' if it does not return ''0''  ==== Or Operator (||) ==== <!--T:135--> <!--T:136-->Performs the logical ''OR'' operation between two Boolean values. A two values must be true so that the result of the operation is true. Represented by the operator ''||''. <!--T:137-->Syntax: <expression> || <expression>Examples: '''IF(("Price" > 1000) || ("Profit" >= 50);75;55)''' - If ''Price'' is greater than ''1000'' '''OR''' ''Profit'' is greater than or equal to ''50'' returns ''75'' if not ''55'' '''IF(("City" != "#null") || ("Product" != 'Lasagna');1;0)''' - If ''City'' is non-null '''OR''' ''Product'' is different from ''Lasagna'' returns ''1'' if it does not return ''0''   ==== Denial Operator (!) ==== <!--T:139--> <!--T:140-->Performs the logical negation operation for a boolean value. If the result of the operation is true the negation operator converts to false and vice versa. Represented by the operator ''!''. <!--T:141-->Syntax: !<expression>Example: '''IF(!BETWEEN("Delivery Date"; '01/01/2015'; '31/12/2015');2016;2015)''' - If the ''Delivery Date'' is '''NOT''' between ''01/01/2015'' and ''12/31/2015'' returns ''2016''. If between this period returns ''2015''  == Auxiliary Functions == <!--T:142--> <!--T:143-->Basic helper functions are standard system functions and implement useful features for composing complex expressions.  ==== ABS function ==== <!--T:144--> <!--T:145-->Function that returns the absolute numeric value of a base numeric value. <!--T:146-->Syntax: ABS(<value operator or expression>)Example: '''ABS("Price" / "Quantity")''' - Returns the absolute value of ''Price'' divided by ''Quantity''  ==== AVG function ==== <!--T:147--> <!--T:148-->Returns the average of the values ​​of a sequence of values. It can be used to return the average of different values ​​of the same row of tables. <!--T:149-->Syntax: AVG(<expression 1>; <expression 2>; ...)Example: '''AVG("Taxes"; "Profit"; "Cost")''' - Returns the average between the sum of the ''Taxes'', ''Profit'' and ''Cost'' columns  ==== BETWEEN function ==== <!--T:150--> <!--T:151-->Checks whether a value is within the limits of the parameters used. Return true or false. <!--T:152-->Syntax: BETWEEN(<expression to be tested>; <initial limit>; <end limit>)Example: '''BETWEEN("Date Issued"; '01/01/2019'; '31/12/2019')''' - Returns true if ''Date Issued'' is between ''01/01/2019'' and ''12/31/2019''. Otherwise returns false ==== COUNT function ==== <!--T:229--> <!--T:230-->Returns number of occurrences (lines) for column or value. <!--T:231-->By now this functions works only at Datasource expressions <!--T:232-->Syntax: COUNT(<expression>) Example: '''COUNT("Product")''' - Returns number of occurrences (lines) of products ==== COUNT_DISTINCT function ==== <!--T:233--> <!--T:234-->Returns number of unique occurrences (lines) for column or value. <!--T:235-->By now this functions works only at Datasource expressions <!--T:236-->Syntax: COUNT_DISTINCT(<expression>) Example: '''COUNT_DISTINCT("Product")''' - Returns number of unique (different) occurrences (lines) of products ==== IF ELSE function (If .... Otherwise ...) ==== <!--T:153--> <!--T:154-->Tests a Boolean expression and applies a condition to true or another condition to false. You need three parameters, separated by semicolons (;). The first parameter is the expression to be tested, the second the value to be applied in case of true, and the third to be applied in case of false. <!--T:155-->Syntax: IF(<expression to be tested>; <expression if true>; <expression if false>)Examples: '''IF(BETWEEN("Value";0;100);10;250)''' - If ''Value'' is between ''0'' and ''100'' returns ''10'', if not ''250'' '''IF("Profit" == 0;0;"Profit" + "Taxes")''' - If ''Profit'' equals ''0'' returns ''0'', if it does not return the sum between ''Profit'' and ''Taxes'' '''IF("Product Code" == 3231;0;"Quantity" * 3;"Quantity")'''- If 'Previous 'Product Code'' equals ''3231'' returns ''Quantity'' plus 3 ==== LOG function ==== <!--T:157--> <!--T:158-->Returns the logarithm of a number on a defined basis. It can be used with only one parameter, in this case the "base 10" logarithm is used . If two parameters are used, the second server to inform the base to be used by the logarithm. <!--T:159-->Syntax: LOG(<expression>;<base>)Examples: '''LOG("Profit")'''- Returns the logarithm of the field ''Profit'' '''LOG("Price";2)''' - Returns the logarithm of the ''Price'' field in base ''2''  ==== MAX function ==== <!--T:161--> <!--T:162-->Returns the largest value between two values. <!--T:163-->Syntax: MAX(<expression 1>;<expression 2>)Example: '''"Value" / MAX("Quantity";1)''' - Divides ''Value'' by the largest value between ''Quantity'' and ''1''  ==== MIN function ==== <!--T:164--> <!--T:165-->Returns the smallest value between two values. <!--T:166-->Syntax: MIN(<expression 1>; <expression 2>)Example: '''"Value" / MIN("Cost"; 100)''' - Divides ''Value'' by the smallest value between ''Cost'' and ''100''  ==== POWER function ==== <!--T:167--> <!--T:168-->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. <!--T:169-->Syntax: POW(<expression>; <exponent>)Examples: '''POW("Profit")''' - Returns the power of the ''Profit'' value. '''POW("Cost"; 3)''' - Returns the power of the ''Cost'' value, raised to ''3''  ==== RANDOM function ==== <!--T:171--> <!--T:172-->Returns a random number within the range of values ​​passed as arguments. <!--T:173-->Syntax: RANDOM(<start limit>; <end limit>)Example: '''RANDOM(10;100)''' - Returns a random number between ''10'' and ''100'' ==== ROUND function ==== <!--T:222--> <!--T:223-->Returns the rounded value of a value column or value. <!--T:224-->Syntax: ROUND(<value>;<precision>) Example: '''ROUND("Profit")''' - If Profit 10.38 returns 10.00 '''ROUND(15.65)''' - Returns 16.00 '''ROUND(1.777;1)''' - Returns 1.8 ==== SQRT function (Square Root) ==== <!--T:174--> <!--T:175-->Returns the square root of a value. <!--T:176-->Syntax: SQRT(<value or expression>)Examples: '''SQRT("Profit")''' - Returns the square root of the value ''Profit'' '''SQRT(81)''' - Returns the square root of ''81''  ==== LIKE function ==== <!--T:178--> <!--T:179-->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. <!--T:180-->Syntax: LIKE(< data>; <term>)Example: '''LIKE("Product"; '%anh%')''' - Returns true if the ''Product'' contains the term ''anh'' or false otherwise == Date Functions == <!--T:181--> <!--T:182-->Date functions are operations that take a date as a parameter and also return a date. There are some constants to assist in using datefunctions, they are: <!--T:183-->* 0: ''DATE_FIELD_YEAR'' (Part of the year)* 1: ''DATE_FIELD_MONTH''(Month Part)* 2: Return ''DATE_FIELD_DAY'' (Daypart)* 3: ''DATE_FIELD_FORTNIGHT'' (Part of fortnight)* 5: ''DATE_FIELD_WEEK'' (Part of the Week)  ==== DATE_PART function (Date Part) ==== <!--T:184--> <!--T:185-->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 closest exact previous date given we want to get. <!--T:186-->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) ==== <!--T:187--> <!--T:188-->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. <!--T:189-->Syntax: DAY_FROM_TODAY(<number of days>)Example: '''DAY_FROM_TODAY(-1)''' - Returns yesterday's date  ==== FIRST_DAY_OF function (First day of) ==== <!--T:190--> <!--T:191-->Returns the first day of a grouping. This function has two variations: <!--T:192-->* With two parameters, the first is the grouping constant from which we want to get the first date (see list above), and monththe second is the base date. <!--T:193-->Syntax: FIRST_DAY_OF(<date part>; <base date>)Examples: ''PREVIOUS_DATE'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 <!--T:195-->* 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. <!--T:196-->Syntax: FIRST_DAY_OF(<expression_daydate part>;<expression_monthdate 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) ==== <!--T:197--> <!--T:198-->Returns the last day of a date grouping. This function has two variations. Need  <!--T:199-->* 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. <!--T:200-->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 <!--T:202-->* 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. <!--T:203-->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) ==== <!--T:204--> <!--T:205-->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 thethird 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). <!--T:206-->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) ==== <!--T:207--> <!--T:208-->Returns the number of days between two dates. Therefore you need two dates. <!--T:209-->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. '''ExamplesNUM_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) ==== <!--T: PREVIOUS_DATE211--> <!--T:212-->Returns the number of months between two dates. Therefore, two date parameters are required. <!--T:213-->Syntax: NUM_OF_MONTHS(<date 1>; <date 2>)Example: '''NUM_OF_MONTHS(FIRST_DAY_OF(0; "Date");4"Date") ''' - return Returns the number of months between the first day of the year and the current month, based on the closest ''01/04Date''column.  ==== PREVIOUS_DATE function (Previous date) ==== <!--T:214--> <!--T:215-->Given a day and a month, in other wordsreturns the last occurrence of that date. That is, until "01/04if 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. <!--T:216-->Syntax: PREVIOUS_DATE(<day>; <month>)Examples: '''PREVIOUS_DATE(15;12)''' - Considering that today's date is 14/11/2019, returns "01the last time December 15th occurred relative to today's date was 15/0412/last year"2018,so this will be the return. after  == Special Variables == <!--T:217--> <!--T:218-->They can be used in conjunction with expressions to create complex calculations. Must be used in double quotation marks (“)  <!--T:219-->* '''"@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]"01/04''' - Average column, similar to ''"@sum[column]"'' /''"@count"''* '''"@prev[column]"''' - Row value before current yearrow for this column* '''"@totalRowValue[column]"''' - Value of total row, (if present), from this column.* '''"@accumCol[column]"''' - Cumulative value from column to current row. Useful for calculating variable mean.** Example: ''"@accumCol[column]"'' / ''"@row"'' </translate>

Navigation menu