Wiki source code of SetMetric
Last modified by Outhman Moustaghfir on 2024/02/26 17:12
Hide last authors
author | version | line-number | content |
---|---|---|---|
![]() |
1.1 | 1 | === Description === |
2 | |||
3 | The SetMetric function is used to set a metric in XSLT. It allows you to specify the name of the metric, its alias (projection), and the desired value. | ||
4 | |||
5 | === Syntax === | ||
6 | |||
7 | {{{ | ||
8 | }}} | ||
9 | |||
10 | {{code language="XML"}} | ||
![]() |
2.1 | 11 | <xsl:value-of select="ixf:SetMetric(metricName, projection, value)"></xsl:value-of> |
![]() |
1.1 | 12 | |
13 | {{/code}} | ||
14 | |||
15 | === Parameters === | ||
16 | |||
17 | * **metricName**: The name of the metric to be set. (Required) | ||
18 | * **projection**: The alias of the metric. (Required) | ||
19 | * **value**: The value to be assigned to the metric. (Required) | ||
20 | |||
21 | === Example === | ||
22 | |||
23 | Consider the following example where the metric "TotalSales" with an alias "SalesAlias" is set to the value 500: | ||
24 | |||
25 | {{{ | ||
26 | }}} | ||
27 | |||
28 | {{code language="XML"}} | ||
![]() |
2.1 | 29 | <xsl:value-of select="ixf:SetMetric('TotalSales', 'SalesAlias', '500')"></xsl:value-of> |
![]() |
1.1 | 30 | |
31 | {{/code}} | ||
32 | |||
33 | This will set the metric named "TotalSales" with the alias "SalesAlias" to the value 500. | ||
34 | |||
35 | === Notes === | ||
36 | |||
37 | * All parameters (metricName, projection, and value) are required. | ||
![]() |
3.1 | 38 | * ((( |
39 | **setMetric **function will add or subtract a value from the previous result. For example, if you input 10 and there was already a value of 500, the result will be 510. | ||
40 | ))) | ||
41 | * Adding 1 will add 1 to the previous value. | ||
42 | * - 1 will subtract 1 from the previous value." | ||
![]() |
1.1 | 43 | |
![]() |
2.1 | 44 | === === |