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

getData only working with atributte "slice"

Answered
Jefferson cardona asked on January 10, 2024

Hello,
In our company, we use Flexmonster with csv data, we expect getData() to return query information for columns other than those present in the dynamic view, but we found that the "options" attributes in the parameter sent to the getData() method, not the use, only the "slice" attribute works.
 
This code, is use for call method getData

let configuration = {
grid: {
type:"flat",
showTotals:"off"
},
drillThrough :false,
configuratorButton:false,
showAggregationLabels:false,
options: {
grid: {
type:"flat",
showTotals:"off"
},
drillThrough :false,
configuratorButton:false,
showAggregationLabels:false
},
slice: {
rows: [
{ uniqueName: "irc_nombre" },
{ uniqueName: "irc_att_01" },
{ uniqueName: "irc_latitud" },
{ uniqueName: "irc_longitud" },
{ uniqueName: "irc_att_05" },
{ uniqueName: "irc_direccion" }
],
columns: [
{ uniqueName: "[Measures]" }
],
measures: [
{uniqueName: 'irc_codigo', aggregation: 'distinctcount', grandTotalCaption: 'Puntos de ventas'}
],
reportFilters :filters,
drills : {
drillAll :true
},
expands : {
expandAll:true
}
}
}

pivot.getData(
configuration,
function(result) { console.log(result)}, function(result) {console.log(result)})

 
 

Attachments:
CapturaJson.png

5 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 11, 2024

Hello, Jefferson!
 
Thank you for reaching out to us.
 
Kindly note that getData() API call is created to extract aggregated data from Flexmonster to pass it to the 3rd party charting libraries and is not recommended for use in other cases. Could you please provide us with more details about your use case so we can advise you on a more suitable solution?
 
Looking forward to hearing from you.
 
Kind regards,
Solomiia

Public
Jefferson cardona January 11, 2024

Hi Solomiia,
 
We need to use getData() to send information to a JS variable, but the response from getData() returns data in a "classic" type format with many unnecessary rows, what we need is the "flat" format. In the documentation, getData indicates that attributes can be sent in "options", but only the "options.slice" attribute is accepted, the "options.grid" attribute is not accepted.
In the previous message, in the code we send a variable "configuration" of type json, where that configuration has "grid" and "slice", the method getData use "slice", but "grid" does not use it. leaving the return of the information in classic format and with rows of groupings with totals, but we need format "flat" and without totals.
Thank you for responding and look forward to you help.
 
 

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 12, 2024

Hello, Jefferson!
 
Thank you for reaching out to us.
 
Kindly note that options from the Flexmonster report won't work in the getData() API call, as this function accepts semantically different options. And, as we said previously, we don't recommend using this API call in other cases than connecting Flexmonster to a 3rd party charting library.
 
Regarding your comment about the flat table, you can set the default view of Flexmonster while initializing the component, and all three view types can be switched via the UI. If you want to change the slice and options dynamically, we recommend combining the setOptions() and runQuery() API calls. Please let us know more about the visualization you want to make with Flexmonster so we can provide you with more details.
 
Looking forward to hearing from you.

Kind regards,
Solomiia

Public
Jefferson cardona January 15, 2024

Hi Solomiia,
So the GetData process has no way to change the structure of the information running in "options.slice". Therefore, always return rows with all groupings united in column and row dimensions, there is no way to send without sums or groupings.
Thank you for responding and look forward to you help.

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster January 16, 2024

Hello, Jefferson!
 
Thank you for getting back to us.
 
You are right, Flexmonster options can't be changed using the getData() function. You are welcome to change the options via the setOptions() API call and the slice using runQuery().
 
Please let us know if you have any further questions.
 
Kind regards,
Solomiia

Please login or Register to Submit Answer