Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
How to catch a missing flat file
Calder
I am trying to catch an error at report runtime caused by a missing flat file.
I use a report parameter to get the name of a service, and then adjust my flatfile datasource using the HomePath binding to point to the correct directory for the service.
Sometimes the directory does not contain the named file. I have already set up the footer to be invisible unless the row count is < 1, at which point it displays a message.
So all I need is to catch the no file error so that an error is not displayed.
Can someone suggest the script I need, and in what event I should put it?
tia
Find more posts tagged with
Comments
johnw
In your initialize or beforeFactory method, do something like:
var file = new Packages.java.io.File(params["path"] + "fileToFind");
if (file.exists() != true)
{
//Handle the error. Either remove the table with the flat file so it doesn't try to execute or display
//an error table by setting a global flag.
}
Calder
thanks for that.
when you say remove the table with the flat file, do you mean with a script?
is there a reference to "execute or display an error table by setting a global flag"
nadavw
<div>Hi,</div><div> </div><div>the following code worked for me:</div><div>(placing it in the 'beforeFactory' script)</div><div> </div><div>if (params["show"].value == 'N')</div><div>{</div><div>//Handle the error. Either remove the table with the flat file so it doesn't try to execute or display</div><div>//an error table by setting a global flag.</div><div>reportContext.getDesignHandle().findDataSet("MyDataSet").drop();</div><div>reportContext.getDesignHandle().findElement("MyChart").drop();</div><div>} </div><div> </div><div>Nadav</div>