pauljschofield Posted May 15, 2017 Share Posted May 15, 2017 I'm trying to hide/display fields, based on values that come back from the report's main query. Is it possible to find (and use) a field's X coordinate in an expression?So, if the report query returns $F{START_POSITION} and $F{END_POSITION} as 20 and 40 respectively, I want to display the fields that are between X=20 and X=40 and hide all the others.The X value is available via the properties pane for all fields, but how do I reference it in an expression? Can that be done?Paul Link to comment Share on other sites More sharing options...
szaharia Posted May 15, 2017 Share Posted May 15, 2017 You need to write a print when expression for each textfield and use the static value of the X-coordinate in each expression. For instance, if the textfield has X = 20, the related print when expression should look like:$F{START_POSITION} <= 20 && $F{END_POSITION} >= 20[/code] Link to comment Share on other sites More sharing options...
pauljschofield Posted May 15, 2017 Author Share Posted May 15, 2017 That was a quick reponse. The method you've given is what I'm doing right now, but I was hoping to future proof things by using the field properties. The report layout might change in future, and editing all the print when expressions again will be painful. If that's how it works though, that's how it works. Thanks again. Link to comment Share on other sites More sharing options...
hozawa Posted May 15, 2017 Share Posted May 15, 2017 To do what you want, you'll need to create your own program using JasperReports library. Jaspersoft Studio just generates a static jrxml file with static x/y coordinates. This is just a limitation of Jaspersoft Studio and not that of JasperReports library itself. Link to comment Share on other sites More sharing options...
pauljschofield Posted May 16, 2017 Author Share Posted May 16, 2017 Thanks Hozawa, I was hoping that the functionality was already there. When you move fields around on screen, the boxes become red when they collide, so Studio does know where things are when you layout the canvas. It's just a pity the functionality isn't more widely available. 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