Despite the COVID-19 outbreak, our team continues operating at full speed. We are always here to support and answer all your questions.

Feel free to reach out by filling this quick form.

Fill the form
Get Free Trial

question about phantom and file excel

Resolved
long yu asked on August 3, 2020

Hello : 
I made a script to create file excel with phantom js and flexmonster.
 
I encountered a problem about data.
 
if there is juste one line in the data(apart from the title), like this 
 
[{
“nbr_appel”: {“type”: “number”},
“Periode”: {“type”: “date”},
“semaine”: {“type”: “string”},
“sum_duree”: {“type”: “number”},
“sum_duree_sonnerie”: {“type”: “number”},
“sum_about_attente”: {“type”: “number”},
“nom_about_groupe”: {“type”: “string”},
“status_appel”: {“type”: “string”},
“sous_status_appel”: {“type”: “string”},
“nom_rubrique”: {“type”: “string”},
“operateur_name”: {“type”: “string”},
“appels_aband_moin_15s”: {“type”: “number”},
“duree_svi”: {“type”: “number”},
“duree_post_appel”: {“type”: “number”},
“temps_attente_x”: {“type”: “number”},
“temps_attente_y”: {“type”: “number”}
},
{“nbr_appel”:”0″,
“Periode”:”2020-07-31″,
“semaine”: “0”,
“sum_duree”:”0″,
“sum_duree_sonnerie”:”0″,
“sum_about_attente”:”0″,
“nom_about_groupe”:”0″,
“status_appel”:”0″,
“sous_status_appel”:”0″,
“nom_rubrique”:”0″,
“operateur_name”:”0″,
“appels_aband_moin_15s”:”0″,
“duree_svi”:”0″,
“duree_post_appel”:”0″,
“temps_attente_x”:”0″,
“temps_attente_y”:”0″}]
 
in the file excel, there are juste title in the file(without data). like file 1.xlsx.
 
 
 
but if there are more than one line in the data, like 
 
[{
“nbr_appel”: {“type”: “number”},
“Periode”: {“type”: “date”},
“semaine”: {“type”: “string”},
“sum_duree”: {“type”: “number”},
“sum_duree_sonnerie”: {“type”: “number”},
“sum_about_attente”: {“type”: “number”},
“nom_about_groupe”: {“type”: “string”},
“status_appel”: {“type”: “string”},
“sous_status_appel”: {“type”: “string”},
“nom_rubrique”: {“type”: “string”},
“operateur_name”: {“type”: “string”},
“appels_aband_moin_15s”: {“type”: “number”},
“duree_svi”: {“type”: “number”},
“duree_post_appel”: {“type”: “number”},
“temps_attente_x”: {“type”: “number”},
“temps_attente_y”: {“type”: “number”}
},
{“nbr_appel”:”0″,
“Periode”:”2020-07-31″,
“semaine”: “0”,
“sum_duree”:”0″,
“sum_duree_sonnerie”:”0″,
“sum_about_attente”:”0″,
“nom_about_groupe”:”0″,
“status_appel”:”0″,
“sous_status_appel”:”0″,
“nom_rubrique”:”0″,
“operateur_name”:”0″,
“appels_aband_moin_15s”:”0″,
“duree_svi”:”0″,
“duree_post_appel”:”0″,
“temps_attente_x”:”0″,
“temps_attente_y”:”0″},
{“nbr_appel”:”0″,
“Periode”:”2020-07-31″,
“semaine”: “0”,
“sum_duree”:”1″,
“sum_duree_sonnerie”:”0″,
“sum_about_attente”:”0″,
“nom_about_groupe”:”0″,
“status_appel”:”0″,
“sous_status_appel”:”0″,
“nom_rubrique”:”0″,
“operateur_name”:”0″,
“appels_aband_moin_15s”:”0″,
“duree_svi”:”0″,
“duree_post_appel”:”0″,
“temps_attente_x”:”0″,
“temps_attente_y”:”0″}]
 
there are data in the file. like 2.xlsx
 
 I had tried with version 2.7.1 and 2.8.11. It’s same.
Could you help me please.
thanks a lot 
 
 
 

Attachments:
1.xlsx
2.xlsx

8 answers

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster August 4, 2020

Hello,
 
Thank you for reaching out to us.
 
Our team wants to explain that we did not manage to reproduce the problem on our side.
You are welcome to see the JSFiddle we have prepared while trying to reproduce the described behavior.
 
Please modify the mentioned JSFiddle or provide us with the corresponding report so that we could reproduce the problem on our side.
 
Also, it would be useful if you could provide us with some details about the way the exporting procedure is implemented. When exactly the exportTo method is called and what is the state of the component itself at the moment of exporting (for example, what report is applied, is the data fully loaded to the component, etc.)?
 
We are looking forward to hearing from you.
 
Kind regards,
Illia

Public
long yu August 4, 2020

thanks a lot for your answer, but it didn’t resole my problem.
i encountered this problem when i use  phantomjs and flexmonster.
and data come from a file json.
could you add a file json in your example plz ?
i tried use a file outside(http://extrablog.fr/file/source.php)
but it refused !

 
Public
long yu August 5, 2020

my codes is :
in the report, data come from a file json. like 
http://extrablog.fr/file/source.php

            i = 0;
loadReport();
function loadReport() {
var val = liste_report[i];
report = jQuery.parseJSON(val['report']['report']);
try{
var pivot = new Flexmonster({
licenseKey: licenceKey,
container: "#pivotContainer",
componentFolder: "../flexmonster/",
customizeCell: customizeCellFunction,
reportcomplete: function() {
pivot.off("reportcomplete");
generateExcel(pivot);
},
exportcomplete: function() {
i++;
pivot.off("exportcomplete");
if (i < liste_report.length) {
loadReport();
}
},
report: report,
});
} catch(error) {
i++;
pivot.off("exportcomplete");
if (i < liste_report.length) {
loadReport();
}
}
}
function generateExcel(pivot_r) {
var params = {
filename : 'test' + i + '.xlsx',
destinationType : 'server',
url : lien_webservice
};
flexmonster.exportTo('Excel', params);
}

and report is
 
{“dataSource”:{“dataSourceType”:”json”,”filename”:”../files/source.php”},”slice”:{“rows”:[{“uniqueName”:”Periode.Year”,”caption”:”Année”},{“uniqueName”:”Periode.Month”,”caption”:”Mois”,”filter”:{“members”:[“periode.month.[août]”]}}],”columns”:[{“uniqueName”:”Periode.Day”,”caption”:”Jour”,”filter”:{“members”:[“periode.day.[2]”,”periode.day.[1]”]}},{“uniqueName”:”[Measures]”}],”measures”:[{“uniqueName”:”nbr_appel”,”aggregation”:”sum”,”caption”:”Nombre appels”,”grandTotalCaption”:”Total Nombre appels”},{“uniqueName”:”durée TMC appel”,”formula”:”sum(\”sum_duree\”) / count(\”nbr_appel\”)”,”caption”:”durée TMC appel”},{“uniqueName”:”Total durée appels”,”formula”:”sum(\”sum_duree\”)”,”caption”:”Total durée appels”},{“uniqueName”:”Total durée attente”,”formula”:”sum(\”sum_about_attente\”)”,”caption”:”Total durée attente”},{“uniqueName”:”Total nombre appel”,”formula”:”count(\”nbr_appel\”)”,”caption”:”Total nombre appel”},{“uniqueName”:”Durée attente Moy.”,”formula”:”sum(\”sum_about_attente\”) / count(\”nbr_appel\”)”,”caption”:”durée attente Moy.”},{“uniqueName”:”sum_duree”,”aggregation”:”sum”,”caption”:”Temps de comm.”,”active”:false},{“uniqueName”:”sum_duree_sonnerie”,”aggregation”:”sum”,”caption”:”Temps de sonnerie.”,”active”:false},{“uniqueName”:”sum_about_attente”,”aggregation”:”sum”,”caption”:”Temps d’attente”,”active”:false},{“uniqueName”:”nom_about_groupe”,”aggregation”:”count”,”caption”:”Groupe”,”active”:false,”availableAggregations”:[“count”,”distinctcount”]},{“uniqueName”:”status_appel”,”aggregation”:”count”,”caption”:”Statut appel”,”active”:false,”availableAggregations”:[“count”,”distinctcount”]},{“uniqueName”:”sous_status_appel”,”aggregation”:”count”,”caption”:”Statut Callback”,”active”:false,”availableAggregations”:[“count”,”distinctcount”]},{“uniqueName”:”nom_rubrique”,”aggregation”:”count”,”caption”:”Rubrique”,”active”:false,”availableAggregations”:[“count”,”distinctcount”]},{“uniqueName”:”operateur_name”,”aggregation”:”count”,”caption”:”Opérateur”,”active”:false,”availableAggregations”:[“count”,”distinctcount”]},{“uniqueName”:”appels_aband_moin_15s”,”aggregation”:”sum”,”caption”:”Appel abandonnée en moins de 15s”,”active”:false},{“uniqueName”:”duree_svi”,”aggregation”:”sum”,”caption”:”Durée SVI”,”active”:false},{“uniqueName”:”duree_post_appel”,”aggregation”:”sum”,”caption”:”Durée post appel”,”active”:false},{“uniqueName”:”temps_attente_x”,”aggregation”:”sum”,”caption”:”Temps attente ≤ 8 sec”,”active”:false},{“uniqueName”:”temps_attente_y”,”aggregation”:”sum”,”caption”:”Temps attente ≤ 10 sec”,”active”:false}],”sorting”:{“row”:{“type”:”desc”,”tuple”:[“periode.year.[2020]”],”measure”:{“uniqueName”:”nbr_appel”,”aggregation”:”sum”}}},”expands”:{“rows”:[{“tuple”:[“periode.year.[2020]”]}]}},”options”:{“grid”:{“title”:”test long222″},”chart”:{“title”:”test long222″}}}

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster August 5, 2020

Hello,
 
Thank you for providing us with your report and your data set. It helped us to reproduce the problem.
 
The current behavior seems to be the bug. It is going to be fixed with a minor update ETA Sept 07.
We will notify you as soon as the version with a fix is available to download.
 
As a temporary workaround, we recommend using AJAX in order to pre-load the data on the page and pass it to Flexmonster as inline JSON. In such case, the problem does not appear. We have modified the previously provided JSFiddle so that it demonstrates the mentioned approach.
It shows two instances of Flexmonster. The first one is connected to the data source (JSON file) directly using the filename property of the dataSource object.
In its turn, the second instance takes the data from the getData function. Such function returns inline JSON, therefore the data property of the dataSource object needs to be used.
 
We hope the workaround works for your case.
Please contact us in case further questions arise.
 
Kind regards,
Illia

Public
long yu August 5, 2020

Thanks a lot.
 

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 8, 2020

Hello,
 
We are glad to announce that the bug when loading a single record from the remote JSON file was fixed.
 
This is included in the 2.8.15 version of Flexmonster.
You are welcome to update the component.
 
Please let us know if it works for you.
 
Best regards,
Illia

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster September 22, 2020

Hello,
 
Our team is wondering whether the recently provided fix works for you.
 
We are looking forward to hearing your feedback.
 
Kind regards,
Illia

Public
long yu September 22, 2020

hi illia .
yes, my problem had been resolved.
thanks a lot for new version and your reponse,
have a good day !
            Long YU

Please login or Register to Submit Answer