6a58bedf99218bbf4bacf38be67e5dfed8e565f6
Guides/ReportDesign/15.0-Expressions-in-Izenda.md
| ... | ... | @@ -103,33 +103,37 @@ Since expressions cannot create fields, but only display calculations based on f |
| 103 | 103 | |
| 104 | 104 | As you may have noticed, we can use some aggregate functions in expressions. In order to prevent SQL injection, only a limited set of SQL functions are turned on by default. |
| 105 | 105 | |
| 106 | -- avg(OrderID) produces the average of all OrderID values. |
|
| 106 | +- **avg(OrderID)** produces the average of all OrderID values. |
|
| 107 | 107 | |
| 108 | -- cast(OrderID, AS DATATYPE) ``e.g. "cast([OrderID] as varchar)"`` Converts a value from one data type to another. This should only be done when you do not want to make a permanent change to the data type, such as converting numeric to strings and concatenating them. |
|
| 108 | +- **cast(OrderID, AS DATATYPE)** ``e.g. "cast([OrderID] as varchar)"`` Converts a value from one data type to another. This should only be done when you do not want to make a permanent change to the data type, such as converting numeric to strings and concatenating them. |
|
| 109 | 109 | |
| 110 | -- convert (DATATYPE, [OrderID]) ``e.g. "convert(varchar, [OrderID])"`` |
|
| 110 | +- **convert (DATATYPE, [OrderID])** ``e.g. "convert(varchar, [OrderID])"`` |
|
| 111 | 111 | |
| 112 | 112 | More information about using these functions can be found [[here|http://msdn.microsoft.com/en-us/library/aa226054(v=sql.80).aspx]] and [[here|http://dev.mysql.com/doc/refman/5.5/en/cast-functions.html#function_cast]] |
| 113 | 113 | |
| 114 | -- count(OrderID) produces a count of all OrderID values. |
|
| 114 | +- **count(OrderID)** produces a count of all OrderID values. |
|
| 115 | 115 | |
| 116 | -- distinct(OrderID) produces a list of all distinct OrderID values. |
|
| 116 | +- **distinct(OrderID)** produces a list of all distinct OrderID values. |
|
| 117 | 117 | |
| 118 | -- isnull(OrderID, x) checks to see if there is a null value in OrderID and replaces it with ‘x’. |
|
| 118 | +- **isnull(OrderID, x)** checks to see if there is a null value in OrderID and replaces it with ‘x’. |
|
| 119 | 119 | |
| 120 | -- length(OrderID) returns the length of a string. Length is used with an Oracle db. If you’re using SQL, see len(OrderID). |
|
| 120 | +- **length(OrderID)** returns the length of a string. Length is used with an Oracle db. If you’re using SQL, see len(OrderID). |
|
| 121 | 121 | |
| 122 | -- len(OrderID) returns the length of a string. Len is used with a SQL db. If you’re using Oracle, see length(OrderID). |
|
| 122 | +- **len(OrderID)** returns the length of a string. Len is used with a SQL db. If you’re using Oracle, see length(OrderID). |
|
| 123 | 123 | |
| 124 | -- max(OrderID) produces the maximum OrderID value within a given range. |
|
| 124 | +- **max(OrderID)** produces the maximum OrderID value within a given range. |
|
| 125 | 125 | |
| 126 | -- min(OrderID) produces the minimum OrderID value within a given range. |
|
| 126 | +- **min(OrderID)** produces the minimum OrderID value within a given range. |
|
| 127 | 127 | |
| 128 | -- round(OrderID, x) takes a decimal value and rounds it to x digits. |
|
| 128 | +- **round(OrderID, x)** takes a decimal value and rounds it to x digits. |
|
| 129 | 129 | |
| 130 | -- sum(OrderID) produces the sum of all OrderID values. |
|
| 130 | +- **sum(OrderID)** produces the sum of all OrderID values. |
|
| 131 | 131 | |
| 132 | -- case when [OrderID] > 10000 then 'valid' else 'invalid' end returns the text string valid if OrderID is greater than 10,000, and the text string invalid if OrderID is 10,000 or less. |
|
| 132 | +- **case when ([OrderID]) > 10000 then 'valid' else 'invalid' end** returns the text string valid if OrderID is greater than 10,000, and the text string invalid if OrderID is 10,000 or less. |
|
| 133 | + |
|
| 134 | +_**Note:** Case statements became available as of version 6.7.0.262._ |
|
| 135 | + |
|
| 136 | +_**Note:** You can nest other functions inside case statements using parenthesis around each nested function (e.g. **case when (SUM([Freight)) > 100 THEN (SUM([Freight])) * (COUNT(OrderID)) ELSE (SUM([Freight])) END**). |
|
| 133 | 137 | |
| 134 | 138 | More information about using this function can be found [[here|http://msdn.microsoft.com/en-us/library/ms181765.aspx]]. |
| 135 | 139 |