We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

availableAggregations is always being set for measures

Answered
Dennis Urech asked on October 9, 2017

Whenever I create a report and try to add or change my measure values, I am being restricted to to only aggregation types of "count" and "distinctcount".  My report definition does not specify "availableAggregations".  This is what my report slice-> measures section looks like in the report that I load

"measures": [
    {
        "uniqueName": "Directive ID",
        "aggregation": "count"
    },
   {
        "uniqueName": "Alert ID",
        "aggregation": "count",
        "active": false,
        "format": "2pdocmwq"
    }
]

After the report is loaded and I attempt to change the aggregation used by either measure, I am restricted to just "count" and "distinctcount".  So, I saved the report (without making any changes) and this is what the same slice-> measures section now looks like:

"measures": [
    {
        "uniqueName": "Directive ID",
        "aggregation": "count",
       "availableAggregations": [
            "count",
            "distinctcount"
        ]
    },
    {
        "uniqueName": "Alert ID",
        "aggregation": "count",
        "active": false,
        "format": "2pdocmwq",
        "availableAggregations": [
            "count",
            "distinctcount"
        ]
    }
]

No matter what I try, I am only given the two aggregation selections.  I am using version 2.324.  I am pretty sure that this is relatively new behavior (at least in the past few months).  I don't usually modify the aggregation selection, but I was doing some testing and just ran across this issue.  I know in the past when I added new measures I was given the full list to choose from.  The really bad thing is the "availableAgrregation" is being stored with saved reports so even if this issue is fixed all previously saved reports will have their existing measures artificially restricted.
 
Update:
I am NOT setting any Global object settings, either

5 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster October 10, 2017

Hello Dennis,
Thank you for providing us with the details. Please have a look at the following example - https://jsfiddle.net/flexmonster/nx37qyjL/ . As you can see there are two fields in measures: "Price" and "Business Type". When you check the aggregations for "Price" you will see that it has such aggregation as "sum", "max", "min" and etc. This means that "Price" has number values, therefore this set of aggregations is available for it. When you check the "Business Type" field you will see that it has only "count" and "distinct count". The reason for it is that "Business Type" has the string values. The "sum", "min" and "max" aggregations are not available for the string. After the report is saved you will see that only "Business Type" has "availableAggregations". Please note that when you define the report and choose fields for measures you cannot define the type of the data there. The data type's can be defined before data loading. We suppose that the "Directive ID" and the "Alert ID" from your data source are the type of string. For instance, "1" , "2" ,"573". They may look like numbers but if the data is in double quotes it will be defined as a string. If you need to have it as a number you should define the data type explicitly. It is how the component always worked. Please have a look at the following articles about the data types - https://www.flexmonster.com/doc/managing-data-presentation-json, https://www.flexmonster.com/doc/managing-data-presentation-csv/ .
Let us know if you have any additional question.
Regards,
Dmytro.

Public
Dennis Urech October 10, 2017

I have verified that my number values are being formatted as strings.  I am changing the formatting ans retesting.  However, if you are going to perform this type of automatic restrictions, while logical, it would be nice if this behavior was documented. If it is I could not find any reference to it
 
I will let you know the results of my test with the reformatted data

Public
Dennis Urech October 10, 2017

It sort of works.  By that I mean, my two ID values still show as restricted to Count and Distinct Count unless I explicitly add a "-" before the field name.  This is strange in that I do not have to do this for several other numeric fields.  They show the full list of aggregate functions.

Public
Dennis Urech October 10, 2017

I did find the restriction documented in the "Data Types in JSON" section.  Since I am not using JSON as my data input format, I did not look in this section.  It would be nice if this information and several other pieces of information in the JSON section was duplicated in the "Data Types in CSV" section

Public
Tanya Gryshko Tanya Gryshko Flexmonster October 11, 2017

Hello, Dennis,
We are glad that everything seems to be working fine.
Thank you for your feedback about the documentation. We will review the sections you mentioned and apply all necessary improvements.
Please contact me in case of other questions.
Regards,
Tanya

Please login or Register to Submit Answer