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

Concatenation with formatting


marlin_snyder

Recommended Posts

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

  • Replies 6
  • Created
  • Last Reply

Top Posters In This Topic

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

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

  • 5 months 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...