Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
580 views
in Technique[技术] by (71.8m points)

jasper reports - How to show several fields values in one textField

Can nay one help to add multiple DB field values in one field.

Say i have 3 DB fields:

Name
Address
Age

I want to display all 3 fields in the same field:

John Peter 28.

I tried doing 3 fields next to each other and it did work but when i wrap text. It looks really bad:

Name

Jo.pe.28
hn te
   r

My requirement is show data in one text field, for example: John.Peter.26

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you want to put them in one line (which i guess is the case), its straight forward.

Put this as a text box $F{Name} + "." + $F{Address} + "." + $F{Age}.toString()

Or you can use string concatenation (I dont personally like the syntax, take more effort to understand) $F{Name}.concat(".").concat($F{Address}).concat(".").concat($F{Age})


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...