marlin_snyder Posted February 21, 2013 Share Posted February 21, 2013 I have an expression for a variable where we are concatenating a string, a double datatype parameter (entered at runtime), another string, another double datatype parameter, and a final string. The expression is shown below: "(+/- " + $P{LCF} + (" Fut ~ +/- ") + $P{LCO} + " Opt)"I would like the two parameters formatted as currency, no matter what the user enters. So they may enter 3, or 1.5, or .4, and they should be formatted as $3.00, $1.50, $0.40 ($.40 would be acceptable).Any recommendations?Thank you,M. Snyder Link to comment Share on other sites More sharing options...
despec Posted February 21, 2013 Share Posted February 21, 2013 Could the answer be as easy as this: "(+/- $" + $P{LCF} + (" Fut ~ +/- $") + $P{LCO} + " Opt)" David Link to comment Share on other sites More sharing options...
marlin_snyder Posted February 21, 2013 Author Share Posted February 21, 2013 That kindof works David, in fact, that's how I have it set up now. The problem is that the Parameters allow for all kinds of entry, for instance, the user could enter 3, or 1.5 (for $3.00 and $1.50 respectively) and if they do that, the resulting string shows as "(+/- $3.0 Fut ~ +/- $1.5 Opt)". I can also append the second 0 at the end of the Parameter, but then if they do enter 3.00 and 1.50, or something like 1.05 it would not show correctly. In the meantime though, thank you for the information, and we can use it until we find another solution. Link to comment Share on other sites More sharing options...
augarte Posted February 22, 2013 Share Posted February 22, 2013 Hello, You can do the following: For each double parameter you have, create another parameter (string type). For example, if you have $P{LCF}, create a $P{LCFstring} parameter. In the parameter "Default Value" attribute set the following: new DecimalFormat ("$0.00").format($P{LCF})Then, set the expression (+/- " + $P{LCFstring} + (" Fut ~ +/- ") + $P{LCOstring} + " Opt)Don't know if it is the best solution but it should work.Hope this helps. Regards.Aitor Link to comment Share on other sites More sharing options...
marlin_snyder Posted February 22, 2013 Author Share Posted February 22, 2013 Thank you Aitor, This method does work (although in the ("$0.00") I did have to escape the $, so ("$0.00")). It accomplishes what I was trying to do dynamically, and overcomes the roadblocks I was hitting... Sincerely, M. Snyder Link to comment Share on other sites More sharing options...
ajinkya_c Posted February 26, 2013 Share Posted February 26, 2013 You can also try with format mask option. Link to comment Share on other sites More sharing options...
nageshit2011 Posted August 14, 2013 Share Posted August 14, 2013 Hi, Can u tell me anybody How to give indian currency in ad hoc view(Ex: 12,13,147.00) 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