kfreisen Posted October 1, 2013 Share Posted October 1, 2013 Hi,So we are trying to set up input controls for our reports that would allow up to get the LoggedInUser's user attributes. To give a little bit of context, we are using external authentication, and the user attributes we are using corrsepond to a collection of ids that we can add to join/where clauses in the input control queries. We also custom utility class that allows us to parse the user attributes and transform them into an sql-safe list (for in statements and whatnot, because the raw attribute value is just a comma seperated string of ids). What I would expect I'd need for this to work is something like this in the jrxml: <parameter name="LoggedInUser" class="com.jaspersoft.jasperserver.api.metadata.user.domain.User" isForPrompting="false"/> <parameter name="userLinkedBriefIds" class="java.lang.String" isForPrompting="false"> <defaultValueExpression><![CDATA[com.jaspersoft.smartbrief.util.UserParamUtil.getAttributeSQLValue($P{LoggedInUser}.getAttributes(), "briefId")]]></defaultValueExpression> </parameter>[/code]Then that I would be able to access that userLinkedBriefIds from the input control query like:select briefid, brief_name from alchemy.dbo.brief bwhere b.activestatus like 'A%'and (b.briefname_alias = '' OR b.briefname_alias is null)and (b.parentid is null)and b.briefid in $P!{userLinkedBriefIds}order by b.brief_name asc[/code]But, the input control doesnt even load in the report and we get an error in the logs with a stacktrace like this (abbreviated since its pretty long)2013-10-01 14:31:17,466 ERROR GenericExceptionMapper,http-8080-5:42 - Unexpected error occursnet.sf.jasperreports.engine.JRRuntimeException: Parameter "userLinkedBriefIds" does not exist. at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.checkParameter(JRAbstractQueryExecuter.java:787) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendParameterClauseChunk(JRAbstractQueryExecuter.java:464) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.appendQueryChunk(JRAbstractQueryExecuter.java:373) at net.sf.jasperreports.engine.query.JRAbstractQueryExecuter.parseQuery(JRAbstractQueryExecuter.java:358) at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.<init>(JRJdbcQueryExecuter.java:139) at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.<init>(JRJdbcQueryExecuter.java:147) at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRTimezoneJdbcQueryExecuter.<init>(JRTimezoneJdbcQueryExecuter.java:127) at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuter.<init>(JSControlledJdbcQueryExecuter.java:65) at com.jaspersoft.commons.util.JSControlledJdbcQueryExecuterFactory.createQueryExecuter(JSControlledJdbcQueryExecuterFactory.java:26) at net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory.createQueryExecuter(AbstractQueryExecuterFactory.java:49) at com.jaspersoft.jasperserver.api.engine.jasperreports.util.JRQueryExecuterAdapter.executeQuery(JRQueryExecuterAdapter.java:92) at com.jaspersoft.jasperserver.api.engine.jasperreports.service.impl.EngineServiceImpl.executeQuery(EngineServiceImpl.java:2117) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:616) I'm able to get the value of the report parameter from the actual report (by either putting it into a text field or by actually using it in the report query), but from the input control its just not working. Has anyone tried anything similiar and had success? Link to comment Share on other sites More sharing options...
sourabh.g Posted October 7, 2013 Share Posted October 7, 2013 Hello Dear,Logged in user name can be passed to query based input control by using the built-in parameter $P{LoggedInUsername}.Just put it $P{LoggedInUsername} ...instead of$P!{userLinkedBriefIds}[/code]This should work . Good luck. Link to comment Share on other sites More sharing options...
cosmohide_1 Posted May 31, 2018 Share Posted May 31, 2018 but how to manage possibility user has not the attribute? on my installation 6.4.2 occure error:2018-05-29 08:59:51,583 ERROR ErrorPageHandlerAction,http-nio-8080-exec-5:118 - Error UID ee1e6984-fd7f-44c9-866c-a566c3846a17com.jaspersoft.jasperserver.api.SessionAttribMissingException: cluster.exception.session.attribute.missingArguments: Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now