Using a Safe

The Safe file contains plain text, so you can use it for any purpose. For example, you can use it for storing all the passwords you need to remember. If you store text in the form:

# This is a comment
Name=Value
Another=Something Else 		
		

then the file can be read as properties, which can be used as parameters to a report or datasource. To use these external properties within a report, you put a script in your Report using the OnRenderBegin trigger:

var props = elxfn.getSafeProperties("/Workspace/Data.safe","pass");
setParameters(props); 		
		

where "pass" is the password to unlock the Safe. The call to setParameters adds the name=value pairs into the report parameter list, so they will be passed to datasources etc. as required. Another benefit of this approach is that it allows you to share a common set of properties across multiple reports and datasources.

If you do not want to hard code the password in the script, you can get it from another parameter:

var pass = getParameterValue("Password");
var props = elxfn.getSafeProperties("/Workspace/Data.safe",pass);
setParameters(props); 		
		

This can either read Pass from the Report parameters, or prompt for a dynamic parameter as you choose.