jmbaker Posted January 3, 2008 Share Posted January 3, 2008 Hi, I have a question concerning layouts. Consider the following text field expression: "Total: "+$F{MB}+"MB used" If the value of MB is a number then it will be output using toString(). But this behaviour is not ideal because the field looks better formatted, which can be done using the Pattern facility on a text field. However this means I need to create three text fields: "Total: " $F{MB} (with a pattern set}"MB used" and place all three text fields beside each other. And this is where I have a problem. The output looks unprofessional if the text isn't perfectly aligned (horizontally), and given the value of $F{MB} is entirely variable, the gap between the fields can not be pre-determined. Is there a facility to make text fields sit beside each other and automtically increase/decrease in width, ensuring all fields are kept close to each other? Thanks, John Link to comment Share on other sites More sharing options...
svenn Posted January 3, 2008 Share Posted January 3, 2008 No there is not. What you could do is create a scriptlet and do the formatting in it. You could then place the formated text in a variable. Link to comment Share on other sites More sharing options...
momzilla Posted January 4, 2008 Share Posted January 4, 2008 NumberFormat.getCurrencyInstance().format($F{choice_amt})+"/"+NumberFormat.getCurrencyInstance().format($F{sp_sup_orig_rate}) is what I do for currency... you will probably want NumberFormat.getInstance() iow, "Total: "+NumberFormat.getInstance().format($F{MB})+" MB used"Post edited by: momzilla, at: 2008/01/03 16:45 Link to comment Share on other sites More sharing options...
jmbaker Posted January 4, 2008 Author Share Posted January 4, 2008 Hello, I'm taking the "X "+NumberFormat...+" Y" route but it's kind of annoying given I thought there were some internal date/number formatting features driven from parameters (REPORT_TIME_ZONE, for example). Surely what I'm asking for is a really sensible idea? Could this be added to the wish list of features? It seems increasibly obvious for anyone wishing to mix dates/numbers & text. Thanks, John 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