brossow Posted January 27, 2015 Share Posted January 27, 2015 I am developing a report (in iReport Designer 5.6.0) that is mostly static and it includes a number of text fields that are optional based on very simple logic. I need these to be a numbered list where the numbering is sequential only for those text fields that are displayed. I know how to use a count-type integer variable when trying to, for example, enumerate query results. But for the life of me I can't figure out a way to make a numbered list that isn't based on a group (there is nothing to be grouped) or counting the results of a query (the list isn't query results).So for example, let's say I have the following text fields:ApplesOrangesOnionsBananasCarrotsPeachesIf I wanted to show them in a numbered list based on just those that are orange, let's say, then my list should look like this:OrangesCarrotsPeachesBut using those same text fields, I may also want to create a sequentially numbered list where only the ones that are fruit are displayed:ApplesOrangesBananasPeachesI found this old thread elsewhere via Google, but there's not enough info in it to help me solve this problem. Is there any way to create a variable that auto-increments without needing to count query results, do grouping, etc.? Obviously I'm not an expert developer and am looking for a solution that's contained within the template (i.e. no external server functions, scripts, etc.).For what it's worth, my actual implementation will be long strings of text, not just one or two words -- the above is brief for better clarity. I tried using an HTML-formatted field and using numbered list tags, but the output was unacceptable. (I need hanging indentation and other formatting that HTML within the text field isn't accomplishing, so I need the actual numbers in standalone text fields.)Thanks in advance for any help! Link to comment Share on other sites More sharing options...
rajesh.sirsikar Posted January 27, 2015 Share Posted January 27, 2015 Hi Brossow,Please check my blog to create a increment number based on a field.http://www.rajeshsirsikar.com/increment-a-variable-in-jaspersoft-studio/Thanks,Rajesh S Link to comment Share on other sites More sharing options...
rajesh.sirsikar Posted January 27, 2015 Share Posted January 27, 2015 Hi Brossow,Check my bolg link below. If you find the solution helpful, please upvote so that others can take advantage.Thanks,Rajesh S Link to comment Share on other sites More sharing options...
brossow Posted January 27, 2015 Author Share Posted January 27, 2015 Thanks, but in your example the detail band is repeating and the number is incrementing based on results of a query (i.e. a list of countries resulting from the field $F{SHIPCOUNTRY}). In my case, the text displayed will not be the results of a query but rather static text that already exists in the report. The only dynamic elements will be the numbering (which I need to be sequential) and the visibility (based on the 'Print when expression') of each band, frame, etc. (that is, whichever of those I decide to use to determine visibility of the item and its corresponding number). To be clear, the list items (Apple, Orange, etc.) that need to be sequentially numbered will _not_ be read in from a query but will already exist in the template. Hope that makes sense. 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