Collecting list values in statistic collector policy for custom analytics report.

Not applicable

How to pass list of values to statistic collection. We have a requirement for example quote. The quote will have one or more coverage's (that is coverage list). The coverage will have coverage id, name and value (premium amount of coverage). We need to get report on coverage's example hot coverage, sum of coverage amount by coverage id etc.

For this, I need to push quote information (quote number, total premium, plan etc) and all the coverage's (id, name premium amount). As number of coverage's are not fixed how can collect list of coverage's in statistic collector? Can it be done (Statistics collector functionality) in javascript?

0 7 343
7 REPLIES 7

Not applicable
@Sujnana Rai

It could be done using Statistics collector policy where u can define the variable based on your input using assign/extract message policy.

Also the variable used in statics collector could be available in Report section Dimension tab under custom dimensions from where u can fetch your reports based on the selected variables .

This will work for simple requirement - one value for single statistics collector. My requirement is pass multiple values (list of coverage's) to single statistics collector.

@Sujnana Rai

I believe the Statistics Collector policy records the current value of one or more variables.

So in that way u can pass multiple values to single SC.

I tried but was not working. In below SC policy I am passing 3 different values to quote_product_code, it collects only last value (value of tgQuoteProductCode2).

<StatisticsCollector async="false" continueOnError="false" enabled="true" name="SC.QuoteStatisticsCollector">
    <DisplayName>SC.QuoteStatisticsCollector</DisplayName>
    <Properties/>

        <Statistic name="quote_transaction_id" ref="tgQuoteTransactionId0" type="STRING"/>
        <Statistic name="quote_transaction_id" ref="tgQuoteTransactionId1" type="STRING"/>
        <Statistic name="quote_transaction_id" ref="tgQuoteTransactionId2" type="STRING"/>
        <Statistic name="quote_product_code" ref="tgQuoteProductCode0" type="STRING"/>
        <Statistic name="quote_product_code" ref="tgQuoteProductCode1" type="STRING"/>
        <Statistic name="quote_product_code" ref="tgQuoteProductCode2" type="STRING"/>
        <Statistic name="quote_plan_code" ref="tgQuotePlanCode0" type="STRING"/>
        <Statistic name="quote_plan_code" ref="tgQuotePlanCode1" type="STRING"/>
        <Statistic name="quote_plan_code" ref="tgQuotePlanCode2" type="STRING"/>
        <Statistic name="quote_total_premium" ref="tgQuoteTotalPremium0" type="double"/>
        <Statistic name="quote_total_premium" ref="tgQuoteTotalPremium1" type="double"/>
        <Statistic name="quote_total_premium" ref="tgQuoteTotalPremium2" type="double"/>
     
    </Statistics>
</StatisticsCollector>

@Sujnana Rai the schema allows for adding new variables but it is a fixed set. You have two options: Option 1: You can define a fixed number of variables (up to a maximum) and you can populate them. One more variable called num_id can tell how many are actually populated. If you have more variables (coverage ids) in one record than this maximum -- you will be out of luck. Option 2: create aggregated variables, e.g., sum(amount), sum(xxx), etc. and num_ids. Also one variable called all_ids and create a concatenated list of the id's as a string and provide. You will have to use string functions on your side to actually break out individual ids.

Here the number of variables (for example coverage's) are not fixed. It can change at any point of time for example backend may introduce new coverages.. Hence, the first option may not help.

I am not clear on second approach. Let us assume for quote, the user selected following coverage's -

Coverage idCoverage Premium
187946.5
1871348
187639
1850178.5
1818158
180176

Here, are you suggesting to sum up the coverage premium ic 46.5+348+39+.... and create consolidated id list separated by delimiter- 1789,1871,1876,..? Or create coma delimited id (1789,1871,1876,) and premium list (46.5, 348, 39...)?

I am not sure how it will help in custom report. Our report requirement is to get maximum number of coverage that user selected or sum of coverage premium collected per coverage id etc. In custom report we can chose only metric and dimensions. We can't use any string functions. Please correct me if am wrong.

you are correct that the custom report will not allow you to apply special string functions. But once you have the data in this "delimited" string format, you can use our APIs (stats) to query and select the dimension field (this string field) and then apply the string functions in your programming module and do breakdowns. You will be processing JSON output from the API.

So, yes, this will require some extra work for you but this is the best approach given your requirement.