Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How do I format a number in RPE?

RPE 6.0.6.1 iFix 21

Using Rational Publishing Engine Document Studio

Trying to publish a value from RTC > WorkItem > AllExtensions > DisplayValue
Number is provided to RPE as (for example) 1000.10

I want to show this as 1,000.10

I have tried parseFloat(displayValue).toLocaleString('en-GB') but this doesn't work (invalid radix?)
Also tried just displayValue.toLocaleString('en-GB') but this returned [object String]

Any other ways?

Many thanks!

0 votes

Comments

Please add appropriate tags to this question, thanks.

I've added a couple more tags


Accepted answer

Permanent link

I supposeĀ displayValue is string. In that case, you can use the following Script Expression in RPE:

displayValue.replace(/\B(?=(\d{3})+(?!\d))/g, ",");

Glyn Costello selected this answer as the correct answer

0 votes

Comments

Thank you. Shame the JavaScript locale functions don't work.

Your answer

Register or log in to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,020
× 152

Question asked: Mar 15 '22, 9:59 a.m.

Question was seen: 855 times

Last updated: Mar 18 '22, 5:46 a.m.

Confirmation Cancel Confirm