Page 1 of 1

Currency Format

Posted: Fri Aug 06, 2010 2:41 pm
by arunkumarmm
Hi All,

Is there a way/Function to change the format of the amount. E.g., Input value is 123456.78 and output should be $123,456.78

Whatever I'm asking is the equivalent of the below server function in parallel:

Server Fn: Oconv(Arg1,"$MD,2")

Posted: Fri Aug 06, 2010 3:03 pm
by anbu
I don't think there is an equivalent for Oconv function

You can try this awk or you can write your own C++ function

Code: Select all

$ echo 1123456.78 | awk -F'.' ' { y=$1;while ($1/1000 != 0) { x=int($1 /1000); sub("^"x,"&,",y); $1=x } print "$"y"."$2 } '
$1,123,456.78
$ echo 123456.78 | awk -F'.' ' { y=$1;while ($1/1000 != 0) { x=int($1 /1000); sub("^"x,"&,",y); $1=x } print "$"y"."$2 } '
$123,456.78

Posted: Fri Aug 06, 2010 3:17 pm
by arunkumarmm
Thanks Anbu.

One more question before I go for one of your suggestions.

BASIC_TRANSFOMER accepts the oconv function in a parallel job. But when I run the job it doesnt provide any proper output for this command. Is there comething we need to do to make it work or It will never work in a parallel job?

If none of the server function will work in a parallel job via Basic_transformer, what is the use of having it?

Posted: Fri Aug 06, 2010 3:31 pm
by anbu
Oconv function should work in BASIC transformer. Check whether you are passing the right arguments to Oconv function

Posted: Fri Aug 06, 2010 3:37 pm
by arunkumarmm
I'm using the function in one of the server job which is working fine. I just copied the same into a parallel job and hard coded the value but that doesnt work :cry:

And thanks for your quick replies Anbu, I really appreciate it! I will mark this topic as resolved as all I wanted to know was, whether there is a equivalent function in parallel or not.