Hi Everyone,
One of the requirement for my job is to represent a decimal number with thousand separators. I have gone through various inbuilt functions available in parallel and not able to find one which can solve this purpose.
For e.g., the decimal 1234567891.23 should be represented as +1,234,567,891.23 in the output.
Has anyone come across this situation? Please give me your inputs on how to achieve this.
Thanks & Regards,
Srikanth
Representing a decimal with thousand separators
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You'll probably need a custom operator if you want a "pure" PX solution.
If you're prepared to use BASIC, which slows PX down somewhat, the solution is easy using Oconv.
The first part of the expression prepends the sign.
The Oconv() function performs two conversions: "MCN" keeps only the numeric characters, while "MD2," expresses the result of that with two decimal places and thousands delimiters.
You have more options if you have NLS enabled, as you can construct a locale that automatically gives you a leading sign, so that you wouldn't need the first part of the above expression.
If you're prepared to use BASIC, which slows PX down somewhat, the solution is easy using Oconv.
Code: Select all
If TheNumber < 0 Then "-" Else "+" : TrimF(Oconv(TheNumber,"MCN":@VM:"MD2,"))
The Oconv() function performs two conversions: "MCN" keeps only the numeric characters, while "MD2," expresses the result of that with two decimal places and thousands delimiters.
You have more options if you have NLS enabled, as you can construct a locale that automatically gives you a leading sign, so that you wouldn't need the first part of the above expression.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Thank you for the reply Ray.
The solution you gave is working after using Basic Transformer. In basic transformer i am able to achieve it even by using Fmt function.
But the client is not accepting this solution. He wants pure PX solution.
How to build a custom operator? Do you mean building a custom transform and then using it in the job? Any clues will be helpful.
Thank you again,
Srikanth
The solution you gave is working after using Basic Transformer. In basic transformer i am able to achieve it even by using Fmt function.
But the client is not accepting this solution. He wants pure PX solution.
How to build a custom operator? Do you mean building a custom transform and then using it in the job? Any clues will be helpful.
Thank you again,
Srikanth
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I'm reminded of nothing more than the PHB who wanted a document faxed on green paper.
My response to the customer would be to ask why a "pure" PX solution is required; doesn't the fact that you can use a BASIC Transformer stage directly from the PX palette mean that you have a "pure" PX solution?
Customisation (including construction of buildops) is an extra charge. See how they react to that.
When you want to know about building custom operators, it's all there in the Parallel Job Developer's Guide. Oh, and you'll need some C skills.
My response to the customer would be to ask why a "pure" PX solution is required; doesn't the fact that you can use a BASIC Transformer stage directly from the PX palette mean that you have a "pure" PX solution?
Customisation (including construction of buildops) is an extra charge. See how they react to that.
When you want to know about building custom operators, it's all there in the Parallel Job Developer's Guide. Oh, and you'll need some C skills.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.