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

Lots of inconsistencies from previous versions (2.5.x) to today's 2.8.1

Answered
Franz J Fortuny asked on February 29, 2020
  1. Can not save the report in json format. None of the buttons (standard) are working, except format, fields and options.
  2. Export is not working
  3. Save is not working
  4. Columns containing strings completely break the presentation of the report. The javascript code TRIES to rearrange the length of string fields and it effectively breaks the whole thing.
  5. In Compact Format, if you open a column that has the next level a string, then the whole report is broken and never restores. You need to close it and avoid ever trying to read string columns/fields.

The attached JSON file used to appear perfectly formatted in version 2.5.x. Right now it simply does not work. This identical file works perfectly when sent to 2.5 version, but fails miserably when sent to Version 2.8.
The part "rows" is what is sent to the pivot.
Too many inconsistencies and very few things working. I have not been able to find the old versions.
Here is the code that WORKS FLAWLESSLY in version 2.5.x but not in version 2.8.1.
_repfl = JSON.parse(p.slice);
_repfl.dataSource = {
data: p.rows,
dataSourceType: "json"
};
flx[glreps] =
window.open("gls/myflexf.html", "_blank", "top=25,left=150,height=650,width=960,menubar=no,location=no,resizable=yes,scrollbars=yes,status=no,titlebar=no", "true");
and here is the code for gls/myflexf.html:
<!DOCTYPE html>
<html>
<head>
<title>My Win Title</title>
<meta http-equiv="refresh" content="864000">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="../flexmonster/flexmonster.js"></script>
</head>
<body>
<div id="fxm"></div>
<script>
var pivot =
new Flexmonster({
componentFolder: "../flexmonster/",
container: "fxm",
report: window.opener._repfl,
toolbar: true,
width: "100%",
height: window.opener._hpiv,
licenseKey: "xxxxxxxx"
});
</script>
</body>
</html>

Attachments:
pivot.json

9 answers

Public
Franz J Fortuny February 29, 2020

I have made some changes:

  1. Using NPM method to install different versions
  2. The code works when the PHP response (echo json_encode($dd)) is gives value to a jsondata variable and then the variable is used as data for the report.
  3. Exactly the same query, received by Javascript in an Ajax call, will give the error Invalid JSON format!

The code had been working for 4 years flawlessly. It was possible to change the slice and change presentation of reporte without loading the data again (from the database).
Any version gives the problem of "Invalid JSON format!", even 2.5 which has been working in my production server for 4 years.
Version 2.8.1 does work OK if data is generated as the page is called (PHP echo feed).
I hope somebody has run into a similar situation and found a way to solve it.

Public
Franz J Fortuny March 1, 2020

I have been testing and testing for hours:
 
The exact same identical JSON content is sent to:
 
Environment of version 2.5
 
Everything works as expected. No errors.
 
Environment of version 2.8.1
 
Error: Invalid JSON format!
 
No way! the JSON format is NOT invalid, or was it invalid in the past but accepted?
 
No way! Simply because all reports were PERFECTLY displayed.
 
I would not know what to do next.
 
Any ideas?

Public
Franz J Fortuny March 1, 2020

Version 2.8.1 IS capable of reading and working with a very huge .json file previously saved locally from a 2.5 query that was arranged in it.
This means that the JSON data have always been valid, however, 2.8.1 has a false-positive reaction interpreting the data as "Invalid JSON format!".
We need to move on with this.
The problem is present whenever the older versions, using the NPM installation process, are used.
The data of the HUGE FILE can be brought from the database in a few seconds, and then saved as an enormous json file that CAN be read and properly interpreted by the newest version, 2.8.1 from february 24.

Public
Franz J Fortuny March 1, 2020

Even more information and details about the problem.
 
They are clearly explained in the attached PDF.
 
By it DOES NOT WORK I mean it always says, as the Pivot Page is opened, that the JSON data is in Invalid Format!

Attachments:
FlexMonsterProblem.pdf

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 3, 2020

Hello, Franz,
 
Thank you for contacting us.
 
We would like to kindly explain that such behavior is entailed by the specifics of your use case.
Getting the information from another window provokes a failing of the validation check. Starting with version 2.5.4, Flexmonster requires the inline data set (p.rows variable in your case) to be an instance of Array in order to avoid downloading the invalid data. Getting the report from the parent window using

window.operner._repfl;

construction affects the way browser perceives the data, that entails failing of the validation check:

(window.operner._repfl.rows instanceof Array) => false

 
However, having the possibility to get the data from another window is a reasonable feature. The fix for the issue is going to be provided with a minor update ETA Mar 23.
 
We will notify you as soon as the version with a problem fixed will be available.
 
Best regards,
Illia

Public
Franz J Fortuny March 3, 2020

The object contained in window.opener._repfl is the complete report, not only the rows. it contains SLICE information, which contains all that is needed to reproduce the report in exactly the same formatting and filters as the retrieved slice from the database.
You see, the data (rows) are only part of what the _repfl object contains. It is a full package, not only the rows. And that is what element "report" in the major object is supposed to contain.
_repfl = JSON.parse(p.slice);
_repfl.dataSource = {
       data: p.rows,
       dataSourceType: "json"
  }
 
So, _repfl contains more than only the rows... 
The first part SETS the SLICE.
 
Once the BIG DATA have been downloaded in the rows part of the reporte, the user can change the slice using this function:

var rep= flx[grep].pivot.getReport();
var nfor = JSON.parse(p.sl);
var repo = {
slice: nfor.slice,
formats: nfor.formats,
tableSizes: nfor.tableSizes,
options: nfor.options,
dataSource: rep.dataSource
}
flx[grep].pivot.setReport(repo);
As you can see, rep.dataSource is the same and the Big Data (rows) do not need to be downloaded again. Just the SLICE changes, which happens at a reasonable speed.
flx[grep] is an array of Flexmonster structures, which the user can be selecting at will, applying a different SLICE (previously saved) according to user's needs.
Did you change what is expected in the construction structure of Flexmonster reports?
Of course, this will always be false, because that is NOT what the _repfl object contains. Why would your code assume  that it contains only the "rows"?

(window.operner._repfl.rows instanceof Array) => false

You must have been calling this in a different way in the past, or else our the reports had not been working for so many years in our web app. Now that you have had a chance to see how we are using and changing the SLICE, please, if you have anything to observe—a better way to change the SLICE once the report has been downloaded—please, mention that over here.

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 6, 2020

Hello, Franz,
 
Thank you for your feedback.
 
We would like to kindly inform you that an additional validation check that causes the problem you are facing has been provided with a version 2.5.4 of Flexmonster. It is dedicated to ensuring that the JSON data is valid.
We are sorry to hear that it entails the conflict with a specific way of passing the data set to the component for your case.
 
We will notify you as soon as a version with a fix of the problem is released.
 
Kind regards,
Illia

Public
Franz J Fortuny March 6, 2020

The following code:

<div><select id="slices" >
<?php
$r=ibase_query("select id,descrip||' - '||idrep,slice from reporspiv where ".
"idrep=$irep");
while($d=ibase_fetch_row($r,IBASE_FETCH_BLOBS)) echo "<option value=$d[0] data-slice='$d[2]' >$d[1]</option>";
?>
</select>

Retrieves the "Slices" or JSON objects to format the report data in a previously saved state.
 
Then, when big data is retrieved, the report can be reformatted without any retrieving of the data. You see, sometimes the retrieved data can weigh dozens of megabytes.
 
So we simply apply a different formatting to the same data, using the following function, which is not perfect since it needs to make an internal copy (which is immediately discarded), the big data report changes formatting in a few seconds:

function setSlice(){
var rep=pivot.getReport();
var repo;
var sl = document.getElementById("slices");
repo = JSON.parse(sl.options[sl.selectedIndex].dataset.slice);
repo.dataSource=rep.dataSource;
pivot.setReport(repo);
}

If the slice and other elements that are needed for the formatting of the report data are not given before the data of the report is given, then the report completely breaks.
 
If the report data is fed into the code following this code:

var pivot =
new Flexmonster({
container: "fxm",
report: {
dataSource: {
data: <?php
$r=ibase_query($sql_text);
$d=array(); while(($d[]=ibase_fetch_assoc($r)));
echo json_encode($d);
?>
}
},
toolbar: true,
width: "100%",
height: window.innerHeight,
licenseKey: "xxx"
});

The strange thing is that our JSON data is valid JSON. So, whatever function you are using is not really validating the data being fed. That is the problem.
 
All that we need is your validation system to truly validate the JSON data we are feeding the pivot system.

Public
Illia Yatsyshyn Illia Yatsyshyn Flexmonster March 24, 2020

Hello, Franz,
 
We are happy to let you know that the issue with “instanceof Array” check in different frames was fixed.
 
This is available in the 2.8.3 version of Flexmonster: https://www.flexmonster.com/release-notes/
 
You are welcome to update the component.
Here is our updating to the latest version guide for assistance: https://www.flexmonster.com/doc/updating-to-the-latest-version/ 
 
Please let us know if everything works fine for you.
 
Best regards,
Illia

Please login or Register to Submit Answer