Need a special offer?Find out if your project fits.
+

Custom API - 2 issues

Answered
Seekme asked on July 22, 2020

Hi,
I've been trying the custom API feature and I stumbled upon 2 things, I already have a working version of Flexmonster with json datas which works great :

First issue is I'm trying to load some formulas, with the json datas format I set multiple formulas (8) like so : 

var evo_volume_pourc = {
formula: '((sum("volumes") - sum("volumes_n1")) / sum("volumes_n1")) * 100',
uniqueName: "evo_volume_pourc",
caption: "Evo % volume vs N-1",
format: 'pourc',
active: false
};

flexmonster.addCalculatedMeasure(evo_volume_pourc);

The same thing with formula works with one formula, but with > 1 formulas, Chrome just freeze. A workaround I found is to declare them in the slice object.
 
Second issue is I'm trying to save my report via a custom save ajax function a the getReport() function. Everything update in order to reflect the current report (rows, colums, filters) EXCEPT measures wich stays the same as when I'm loading the page.
Sorry for no js-fiddle but I'm only having issue with the custom API and js-fiddle doesn't like that.
Thanks ! 

7 answers

Public
Seekme July 22, 2020

I would like to add that I just update my .js from 2.8.0 to 2.8.11 (last version) and a popup says that I must set my API version to 2.8.5 wich does not correspond to my .js version.
Also, updating the .js to 2.8.11 does not display datas at all, even if I see them in my members function call.

Public
Vera Didenko Vera Didenko Flexmonster July 23, 2020

Hello, 
 
Thank you for reaching out to us. 

  1. About calculated measures:
    We have managed to reproduce the issue with page freezing when the addCalculatedMeasure() API call is called several times in a row.
    This problem occurs on our end when calling the method on the reportcomplete event.
    Our team will take a closer look at it. The fix will be available with the ETA 21st of September.

    Meanwhile, we kindly recommend setting the calculated measures through the slice.

  2. Regarding measures not updating in the report:
    Could you please provide more details about the problem? Is your custom save function being called on a specific Flexmonster event?
    If possible, could you please demonstrate the problem by modifying the following custom data source API JSFiddle example: http://jsfiddle.net/flexmonster/7bnt5f6x/?

    This will greatly help us to understand the situation better.

  3. About updating Flexmonster from 2.8.0 to 2.8.11:
    We would like to explain that in the 2.8.5 version of Flexmonster several changes have been introduced to the custom data source API. 

    Our team would like to explain that although in the 2.8.5 minor release the changes did turn out to be major, this is not the usual outcome: major changes are usually introduced in major release versions. Major releases are accompanied by a detailed migration guide to help make the migration process simpler and easier. 

    To help identify the 2.8.5 changes easier, we have prepared a list of the corresponding changes:

    3.1) Data types have been removed from queries:
    For example:

    Members query:

    {
        "index": "data-set-123",
        "type": "members",
        "field": {
           "uniqueName": "city"
        },
        "page": 0
    }

    Select:

    {
        "index": "data-set-123",
        "type": "select",
        "query": {
            "aggs": {
                "values": [{
                    "func": "sum", 
                    "field": {
                       "uniqueName": "price"
                    }
                }],
                "by": {
                    "rows": [{
                       "uniqueName": "city"
                    }],
                    "cols": [{
                       "uniqueName": "color"
                    }]
                }
            }
        },
        "page": 0
    }

    These changes are applied in the following places:
    3.1.1) https://www.flexmonster.com/api/field-object/
    3.1.2) https://www.flexmonster.com/api/members-request/
    3.1.3) https://www.flexmonster.com/api/select-request-for-pivot-table/
    3.1.4) https://www.flexmonster.com/api/select-request-for-flat-table/
    3.1.5) https://www.flexmonster.com/api/select-request-for-drill-through-view/

    3.2) Support for advanced filters has been added: 

    This change provides the possibility to implement and use advanced filters.
    Hence, the advanced property to the /fields response has been added making it possible to specify if advanced filters are implemented on your backend or not (please see: https://www.flexmonster.com/api/fields-request/ ).

    For implementing advanced filters, the following changes were introduced:
    3.2.1) /members request: https://www.flexmonster.com/api/members-request/
    The filter was added as a parameter to the response's description.
    The request was not changed.

    3.2.2) /select request for the pivot table: https://www.flexmonster.com/api/select-request-for-pivot-table/
    The request's description now includes the filter object.
    The response was not changed.

    3.2.3) /select request for the flat table: https://www.flexmonster.com/api/select-request-for-flat-table/
    The filter parameter was specified as an array of filter objects.
    The response was not changed.

    3.2.4) /select request for the drill-through: https://www.flexmonster.com/api/select-request-for-drill-through-view/
    Just like with the /select request for the flat table, the filter parameter's type has been specified.
    The response was not changed. 

    3.3) Multilevel hierarchies can now be defined:

    Supporting advanced filters makes it possible to define multilevel hierarchies for the custom data source API as well.
    Multilevel hierarchies can be defined through the mapping property of the dataSource object. 
    For more information about the mapping object please see the following guide: https://www.flexmonster.com/doc/mapping/

 
Please let us know if this helps. 
Looking forward to your reply.
 
Kind regards, 
Vera

Public
Seekme July 23, 2020

Thank you for your answer.
I tried reproducing my issue on this js-fiddle : http://jsfiddle.net/20nse84w/ but it says "Unable to connect to custom data source API endpoint 'http://olap.flexmonster.com:9202/api/cube/fields'."
Anyway I made my custom save function so the test is :
Load the datas, manipulate the "measures" field so it differs from the initial one, save the report and see the object in the console displaying the report. As you can see the measures field is still the initial one and not the current one.

Public
Seekme July 23, 2020

Ok my bad, I didn't notice that it keeps the formulas but with a "active : false" state.

Public
Vera Didenko Vera Didenko Flexmonster July 23, 2020

Hello, 
 
Thank you for your response and for providing a sample for illustration. 
 
We are glad to hear that the issue with measures not updating in the report is resolved. 
 
You are welcome to contact us in case any further questions arise. 
 
Kind regards, 
Vera

Public
Milena Pechura Milena Pechura Flexmonster September 22, 2020

Hello,
 
We are happy to let you know that the issue with page freezing when the addCalculatedMeasure() API call is called several times in a row was fixed.
This is available in the 2.8.16 version of Flexmonster: https://www.flexmonster.com/release-notes/.
 
You are welcome to update the component: https://www.flexmonster.com/doc/updating-to-the-latest-version/.
 
Please let us know if everything works fine for you.
 
Best regards,
Milena

Public
Milena Pechura Milena Pechura Flexmonster September 30, 2020

Hello,
 
Our team is interested in whether the recent fix helped.
Did you have a chance to update to version 2.8.16?
 
We are looking forward to hearing from you.
 
Kind regards,
Milena

Please login or Register to Submit Answer