Page 1 of 1

How to force load an .mrt in Viewer?

Posted: Thu Jun 08, 2017 3:25 pm
by nexar
While I'm still developing reports I often need to 'design/save/view' the report. However both Chrome and FireFox don't ALWAYS force load the mrt but instead serve up the old mrt from cache.

This probably isn't a Stimulsoft Reports problem but if anyone has already solved this then I would be very grateful for an answer please.

Thanks

Re: How to force load an .mrt in Viewer?

Posted: Thu Jun 08, 2017 5:46 pm
by nexar
I should have explained that I have a generic html file which creates a viewer and then takes the parameter from the viewer url to get the .mrt file. However due to the cacheing I often got the old .mrt file. So after a bit of googling I found that if I include a dummy random variable value after my report.loadFile("/path/to/mrtfile/repname.mrt") command by changing it to :

report.loadFile("path/to/mrtfile/repname.mrt?randomvar")...then because it was a new URL my latest repname.mrt would get loaded.

The JS function that I 'took' from someone else was:

Code: Select all

        function randomvar()
        {
            var text = "";
            var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

            for( var i=0; i < 7; i++ )
                text += possible.charAt(Math.floor(Math.random() * possible.length));

            return text;
        }
So now my report.loadFile looks like this:

report.loadFile("/reports/mrt/"+repname+".mrt?"+randomvar());

.....And my latest .mrt report is ALWAYS loaded!!

Re: How to force load an .mrt in Viewer?

Posted: Fri Jun 09, 2017 1:03 pm
by Alex K.
Hello,

Ok.
Could you clarify that issue is solved?

Thank you.