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)
Expression evaluating
Rainer
Hi all, I?m facing some problem while using report api in my own application. To provide some logic in report parameters, I use javascript expressions in reports dataset parameter default values. A concrete parameter does not exist only the default value (a javascript expression) should be evaluated. With normal parameters evaluation of default values work well while calling "IGetParameterDefinitionTask.getDefaultValue(IScalarParameterDefn))" Javascript expressions are evaluated correctly. Now my problem is to manually evaluate javascript expressions which are defined as OdaDataSet parameters. If I try to call "ScriptContext.evaluate(context.compile("javascript", "<inline>", 1, jsCode));" which normally works I get an Exception with message that reportContext (which is called in the script) is not available.
Does anybody know how to evaluate javascript expressions correctly within the described context?
Regards Rainer
Find more posts tagged with
Comments
CBR
Does it work if you call
task.evaluateDefaults()
before asking the task for the default values?
Rainer
task.evaluateDefaults() is marked as deprectated in 2.6.2 and doesnt seem to have any effect. Thanks for your suggestion.
CBR
Sorry you are right. It was replaced by task.getDefaultValues.
Does it make a difference if you use it to retrieve the default values?
Rainer
task.getDefaultValues() doesn?t evaluate expressions. It just returns the expressions as Strings.
JasonW
What value in reportContext are you trying to get at? The default Engine tasks setup an ExecutionContext that stores an instance of IReportContext as the variable name reportContext.
scriptContext.setAttribute( "reportContext", reportContext );
Jason
Rainer
Jason,
I want to integrate some customer specific values from properties file which in designer I can get by calling reportContext.getMessage(XY);. We created one report for all our customers. To seperate data we use some specific value in parameter dataset query which is provided by a per user properties file. Could you please provide an example how to get Execution Context or reportContext from lets say the IGetParameterDefinitionTask? I searched for this a while but could not get any example.
Thanks for your help
Rainer
JasonW
I am not certain I understand why you need to evaluate the expressions outside of the task. Currently the Execution Context is a protected member of the task and does not have a getter.
Jason
Rainer
Jason,
I solved my problem by using the IGetParameterDefinionTask. I think my first approach was the result of a lack of understanding how to use the api correctly.
Thanks for your help.
Rainer