terco Posted June 9, 2011 Share Posted June 9, 2011 Hello,I am trying to use the Profile Attributes within the main query of a report.The idea is to bring that information to the where clause of the query.There are Parameter available which provide this data:http://jasperforge.org/plugins/mwiki/index.php/Jasperserver/Cascading_input_controlsLoggedInUserAttributes, LoggedInUserAttributeNames, LoggedInUserAttributeValues and LoggedInUserAttribute_<attribute name>So far I was able to use LoggedInUserAttribute_<attribute name> in a query, like this:select * from table1 t1where t1.col1 in ($P!{LoggedInUserAttribute_MyAttr1})For that, I have to save the attributes this way: [MyAttr1:'Value1a','Value1b']with the single quotes.The problem with this solution, besides that's not elegant, is that if a user doesn't have that attribute set, it comes to a Java exception.If I use LoggedInUserAttributeValues with $X (taking out the single quotes):select * from table1 t1where $X{IN, t1.col1, LoggedInUserAttributeValues}then all values from all attributes are inserted (not only MyAttr1 values but also MyAttr2) and in a block. From jlog:where t1.col1 IN (?, ?)DEBUG JRJdbcQueryExecuter,http-48080-7:305 - Parameter #1 (LoggedInUserAttributeValues[0] of type java.lang.String): Value1a, Value1bDEBUG JRJdbcQueryExecuter,http-48080-7:305 - Parameter #2 (LoggedInUserAttributeValues[1] of type java.lang.String): Value2a, Value2b, Value2cIs there a way to use the mentioned Parameters or there are others which allow the same as LoggedInUserAttribute_<attribute name> does but which are of collection type so that they can be used with an $X .Or can you think of another way to solve this problem?Many thanks! Link to comment Share on other sites More sharing options...
mandm Posted June 16, 2011 Share Posted June 16, 2011 let me know if you got resolution for this? Link to comment Share on other sites More sharing options...
taha.touati.pro Posted August 30, 2013 Share Posted August 30, 2013 Hello everyone,I tried : select *from table1 t1where $X{IN, t1.col1, LoggedInUserAttribute_MyAttribute}But it doesn't work! because LoggedInUserAttribute_MyAttribute return a String element (the value of MyAttribute : city1, city2, city3 or ('city1', 'city2', 'city3'), we can't use IN for String value.Any one have an idea please?!!Regards Link to comment Share on other sites More sharing options...
taha.touati.pro Posted August 30, 2013 Share Posted August 30, 2013 Im looking for the same problem! 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