Jump to content
We've recently updated our Privacy Statement, available here ×

Carry over variable


icet18

Recommended Posts

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

  • Replies 14
  • Created
  • Last Reply

Top Posters In This Topic

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

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

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

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}>1

How 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

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?

 

thanx

iceT

What 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

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 page

it'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

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

  • 5 months later...

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.Integer

Calc: Highest

Reset type: Report

Increment type: Report

Var 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.Integer

Calc: Nothing

Reset type: Page

Increment type: None

Var 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

  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...