Changes for page InitMetrics
Last modified by Outhman Moustaghfir on 2024/02/26 17:12
edited by Outhman Moustaghfir
on 2024/02/01 17:24
on 2024/02/01 17:24
edited by Outhman Moustaghfir
on 2024/02/01 12:57
on 2024/02/01 12:57
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,85 +3,12 @@ 1 - 2 - 3 3 == InitMetrics Function Documentation == 4 4 5 5 === Overview === 6 6 7 -The **InitMetrics**function provides functionality to initialize metrics in a flexible way. It allows for the deletion of metrics, projections, and the initialization of projections with fixed values or XPath expressions.5 +The InitMetrics function provides functionality to initialize metrics in a flexible way. It allows for the deletion of metrics, projections, and the initialization of projections with fixed values or XPath expressions. 8 8 9 -= Usage = 10 - 11 -{{code language="XML"}} 12 -<xsl:value-of select="ixf:InitMetrics('Metric','Projection','Value')"></xsl:value-of> 13 -{{/code}} 14 - 15 15 === Request Parameters === 16 16 17 -1. **metricName (Required):** The alias of the metric to be manipulated. 18 -1. ((( 19 -**projection (Optional):** The specific projection within the metric. If provided: 20 - 21 -* If value is not provided, the specified projection will be deleted. 22 -* If value is provided, the projection will be initialized with either a fixed value or an XPath expression. 23 -))) 24 -1. ((( 25 -**value (Optional):** The value used for initialization. Depending on the context: 26 - 27 -* If projection is provided, value initializes the projection. 28 -* If value is not provided, the specified projection is deleted. 29 -))) 9 +1. **metricName (Required):** The alias of the metric to be initialized. 10 +1. **projection (Optional):** The specific projection to initialize or delete. 11 +1. **value (Optional):** The value used for initialization. For deleting metrics or projections, this parameter can be omitted. 30 30 1. **defaultValue (Optional):** The default value used in case of XPath expression evaluation failure. Defaults to 0 if not provided. 31 - 32 -=== Usage Examples === 33 - 34 -Remember to adapt the metric names, projection names, and values based on your actual scenario. The provided examples are placeholders, and you should replace them with your specific metric, projection, and values. 35 - 36 -1. ((( 37 -**Delete Metric:** 38 - 39 -{{code language="XML"}} 40 -<xsl:value-of select="ixf:InitMetrics('YourMetricName')"></xsl:value-of> 41 -{{/code}} 42 - 43 - 44 -**Example using Fixed Value:** 45 - 46 -Assuming you want to initialize a projection named 'YourProjection' in the metric 'YourMetric' with a fixed value of 42: 47 - 48 -{{code language="XML"}} 49 -<xsl:value-of select="ixf:InitMetrics('YourMetric', 'YourProjection', '42')"></xsl:value-of> 50 -{{/code}} 51 - 52 -{{{ 53 - }}} 54 - 55 -This example initializes the 'YourProjection' projection in the 'YourMetric' metric with the fixed value of 42. 56 - 57 -**Example using XPath Expression:** 58 - 59 -Assuming you want to initialize a projection named 'YourProjection' in the metric 'YourMetric' with an XPath expression 'Order[Company = 'HM']' and a default value of -1: 60 - 61 -{{code language="XML"}} 62 -<xsl:value-of select="ixf:InitMetrics('YourMetric', 'YourProjection', 'Order[Company = ''HM'']', -1)"></xsl:value-of> 63 -{{/code}} 64 - 65 - 66 -This example initializes the 'YourProjection' projection in the 'YourMetric' metric with the provided XPath expression. If the XPath expression fails to evaluate, it uses the default value of -1. 67 -))) 68 -1. ((( 69 -**Example for Counting Trackings with XPath Expression:** 70 - 71 -Assuming you want to count trackings where the 'Company' is 'HM' using an XPath expression: 72 - 73 -{{{ 74 - }}} 75 - 76 -<xsl:value-of select="ixf:InitMetrics('YourMetric', 'YourProjection', 'Order[Company = ''HM'']', -1)"/> 77 - 78 -This example uses an XPath expression to count trackings where the 'Company' is 'HM'. If the XPath expression fails, it uses the default value of -1. 79 -))) 80 - 81 -=== Notes === 82 - 83 -* If projection is not provided, the entire metric is deleted. 84 -* If value is not provided, the specified projection is deleted. 85 -* The defaultValue parameter is optional and only applicable when initializing projections with XPath expressions.