How to force load an .mrt in Viewer?

Stimulsoft Reports.JS discussion
Post Reply
nexar
Posts: 31
Joined: Tue May 02, 2017 5:55 pm

How to force load an .mrt in Viewer?

Post 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
nexar
Posts: 31
Joined: Tue May 02, 2017 5:55 pm

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

Post 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!!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

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

Post by Alex K. »

Hello,

Ok.
Could you clarify that issue is solved?

Thank you.
Post Reply