icet18 Posted April 7, 2010 Share Posted April 7, 2010 Hi,I'm quite new with ireport/jasperreport so i hope somebody of you can help me?!?I have got two questions:1.) Is it possible to convert a String to a Double with IReport/Jasperreport?2.) The second is much more important. I want to make a carry-over (I hope this is the right englisch word). How can i make this?Sure i make a variable, say SUM, say the reset type and so on.But how can i make this, that the carry over is (eg. i have 2 pages) on the first page below my positions, and on the second page over my positions?Example:1page######1|2pices|2€|4€1|2pices|2€|4€--------------------carry over = 8€ 2page####carry over = 8€1|2pices|2€|4€-------------------end price = 12€ Thank you very much!iceT Link to comment Share on other sites More sharing options...
slow Posted April 7, 2010 Share Posted April 7, 2010 to convert a String to Double use:Double d = Double.valueOf(yourFormattedString) the report that uses your carry-over variable contains only two pages? ______________________________if it works... KARMA point please! : ) Link to comment Share on other sites More sharing options...
icet18 Posted April 7, 2010 Author Share Posted April 7, 2010 Thank you for your answer.No, my report can have 1 to n pages.So when i have 1 page i do not need a carry over, when i have more pages i need a carry over. ThanxiceT Link to comment Share on other sites More sharing options...
slow Posted April 7, 2010 Share Posted April 7, 2010 do you know the number of rows that your pages have?this number is fixed or it's variable? Link to comment Share on other sites More sharing options...
icet18 Posted April 7, 2010 Author Share Posted April 7, 2010 The report is for creating a bill.So all i know is how many rows fitts on a page (eg. 19 rows). But it is also possible that there are only 5 rows on the page (1-page- bill). Or eg 3 rows on the last page (2-page-bill). So its variable :-) Thanx Link to comment Share on other sites More sharing options...
slow Posted April 8, 2010 Share Posted April 8, 2010 oookkk...it's too hard to explain all single steps to do to obtain what you want...so try to study this small example attached to this post... I make it for you.pay attention to the setting of variables, evaluation type of single textfield, sum type, reset type... to all element :)it's is a very simple report example, so simple to let you focus only to variable creation and settings.I include dummy query to obtain some integers from a dummy connection... so the report is generic. i think it is what you want :) ______________________________if it works... KARMA point please! : ) Post Edited by slow at 04/08/2010 08:37 Link to comment Share on other sites More sharing options...
icet18 Posted April 8, 2010 Author Share Posted April 8, 2010 Wow, thanks for you work! It looks a little bit difficult, but it is almost that what i need! :-) I will try to build your functionallity to my jasper file today!Can you please answer one more question to me?How can i tell a variable or a static text (e.g. the carry over) not to be shown on the last page (but on all pages before)?For not showing on the first page i can say:Print when expression: $V{PAGE_NUMBER}>1How can i do this for the last page, when i have a varibel page number. Thank you very much. iceT Link to comment Share on other sites More sharing options...
slow Posted April 8, 2010 Share Posted April 8, 2010 uhm....read this:http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=68915&topid=71858#71858and don't forget to read in the previous forum post! :)and remenber to give me karma points :) Link to comment Share on other sites More sharing options...
icet18 Posted April 9, 2010 Author Share Posted April 9, 2010 sry,i tried to get the last page, but maybe it is impossible with my knowledge :-(I made the currentPage variable, i have my textfield as double (carry over).my textfield (variable) is called "$V{uebertrag}"the textfield sums up some values for my carry over. I want to hide this $V{uebertrag} on the last page.on the text field expression there stands of course$V{uebertrag} now i have to rewrite the text field expression with this:$V{currentPage}.equals($V{PAGE_NUMBER}) ? "SHOW" :"HIDE"??? I also tried this :$V{currentPage}.equals($V{PAGE_NUMBER}) ? "$V{uebertrag}" :""but i doesnt work! are SHOW and HIDE some internal parameters? thanxiceTWhat about the karma points? i gave you one! Can i give you as much as i want, or what :-)? Post Edited by icet18 at 04/09/2010 07:25 Link to comment Share on other sites More sharing options...
slow Posted April 9, 2010 Share Posted April 9, 2010 try to study and use this example...understand that I'm at work and I haven't plenty of time to explain in detail how to use variables ...the example show how to use variables and combination of "print when" and "Text expression" to print a texfied- only in the first page- in all pages except last- only on last pageit's a work-in-progress and partial example... and it may not solve all the questions, so, as I understand the secrets of jasper I'll try to improve it :)I should consider opening an online office to give jasper advice :) ______________________________if it works... KARMA point please! : ) Link to comment Share on other sites More sharing options...
icet18 Posted April 9, 2010 Author Share Posted April 9, 2010 1000 thanks to you! Let me say, you are my IReport-Hero :-)!!!Everything work fine! Sry for wasting your time. Tell your boss greetings from me ;-)The next karma point for you is sure.thanx iceT Link to comment Share on other sites More sharing options...
slow Posted April 9, 2010 Share Posted April 9, 2010 ahaha... :)my boss will probably fire me immediately if he know that I help others than to work for him :)He does'nt know how I use Ireport... :) if I'm in Austria maybe you can offer me a good beer...ciao! Post Edited by slow at 04/09/2010 10:02 Link to comment Share on other sites More sharing options...
tgs Posted September 27, 2010 Share Posted September 27, 2010 Hello slow,your samples helped me a lot. Thank you for that.But I have a problem with the variable:'max_page' =Class: java.lang.IntegerCalc: HighestReset type: ReportIncrement type: ReportVar Expression: $V{PAGE_NUMBER}Init. value Expr.: new Integer(0)--I have set the 'Print When Expression' of the $V{carry_over} on the column footer to:new Boolean($V{cur_page}.intValue() < $V{max_page}.intValue())--'cur_page' =Class: java.lang.IntegerCalc: NothingReset type: PageIncrement type: NoneVar Expression: $V{PAGE_NUMBER}Init. value Expr.: new Integer(0)--But the $V{carry_over} is not printed (or in the viewer) if the report has more than one pages!?I tried: new Boolean($V{carry_over}.doubleValue() < $F{total}.doubleValue())and this is working if rows are also on the second, third... page. If all rows on the first page and 'Summary' Band is on the second page, the carry over variable is hidden.What is wrong?Regards,Thomas Link to comment Share on other sites More sharing options...
tdtappe Posted December 18, 2014 Share Posted December 18, 2014 Sorry for posting to such an old discussion. But I have the same "carry over" - problem as described above.Unfortunately the mentioned sample report does not or no longer exist? Can anybody help?--Heiko Link to comment Share on other sites More sharing options...
djohnson53 Posted December 18, 2014 Share Posted December 18, 2014 FYI: the Jasperforge link will not work. 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