Page 1 of 1

Modify Usage

Posted: Wed Aug 03, 2005 3:52 am
by benny.lbs
As you may know, when convert Decimal to String, a leading space and trailing full stop will exist.

Can Modify stage achieve the convertion without space and full stop?

I know

Code: Select all

E:string[5] = substring[0,5](A)
C:string[7] = string_from_decimal(B)
But when I use the following statement, it failed with

Code: Select all

C:string[7] = substring[1,5](string_from_decimal(B))
main_program: Error parsing modify adapter: Error in binding: Expected ')', got: "("
Is it my syntax error ? How to combine ? Please help

Thanks in advance.

Posted: Wed Aug 03, 2005 5:59 pm
by vmcburney
Let me make it even easier for you.

Code: Select all

E:string[7]=string_from_decimal[suppress_zero](A)
The suppress_zero option is not documented anywhere in the Parallel Job Developers Guide but it is in the Orchestrate Operator's reference.
stringField = string_from_decimal[fix_zero][suppress_zero] (decimalField)
Converts decimals to strings.
fix_zero causes a decimal field containing all zeros to be treated as a valid zero.
suppress_zero specifies that the returned ustring value will have no leading or trailing zeros.
Examples: 000.100 -> 0.1; 001.000 -> 1; -001.100 -> -1.1
suppress_zero also gets rid of the leading space and the decimal point. This makes it more useful then the standard string_from_decimal and a handy undocumented flag.

Posted: Wed Aug 03, 2005 7:26 pm
by benny.lbs
vmcburney,

Thanks your information. If I would like the string with fix_zero case, how to handle ?
vmcburney wrote:Let me make it even easier for you.

Code: Select all

E:string[7]=string_from_decimal[suppress_zero](A)
The suppress_zero option is not documented anywhere in the Parallel Job Developers Guide but it is in the Orchestrate Operator's reference.
stringField = string_from_decimal[fix_zero][suppress_zero] (decimalField)
Converts decimals to strings.
fix_zero causes a decimal field containing all zeros to be treated as a valid zero.
suppress_zero specifies that the returned ustring value will have no leading or trailing zeros.
Examples: 000.100 -> 0.1; 001.000 -> 1; -001.100 -> -1.1
suppress_zero also gets rid of the leading space and the decimal point. This makes it more useful then the standard string_from_decimal and a handy undocumented flag.

Posted: Wed Aug 03, 2005 8:55 pm
by vmcburney
Simply add the word surrounded by square brackets in your specification. Add [fix_zero] and/or [suppress_zero].

Posted: Thu Aug 04, 2005 1:52 am
by benny.lbs
You mean ?

Code: Select all

C:string[7] = string_from_decimal[fix_zero,suppress_zero](B)
I would like to know how to use fix_zero option, but without leading space and trailing decimal point.

Would you please give me a sample, thanks a lot.
vmcburney wrote:Simply add the word surrounded by square brackets in your specification. Add [fix_zero] and/or [suppress_zero].

Posted: Thu Aug 04, 2005 5:28 pm
by vmcburney
No, as per the documentation:
stringField = string_from_decimal[fix_zero][suppress_zero] (decimalField)
C:string[7] = string_from_decimal[fix_zero][suppress_zero](B)

Posted: Thu Aug 04, 2005 6:10 pm
by benny.lbs
Job Aborted.
main_program: Error parsing modify adapter: Error in binding: Expected '(', got: "["
Expected destination field selector, got: ")"; input:
C:string[7] = string_from_decimal[fix_zero][suppress_zero](B)
;
vmcburney wrote:No, as per the documentation:
stringField = string_from_decimal[fix_zero][suppress_zero] (decimalField)
C:string[7] = string_from_decimal[fix_zero][suppress_zero](B)

Posted: Thu Aug 04, 2005 6:59 pm
by vmcburney
Good point! I posted without testing it first. Your original syntax was correct and my correction was incorrect. You should use [fix_zero, suppress_zero] instead of [fix_zero][suppress_zero].

Posted: Fri Aug 05, 2005 1:34 am
by benny.lbs
But the result is the same as only [suppress_zero].

e.g.
A Decimal(5,0)

123

I want "00123", not "123" or " 00123."
vmcburney wrote:Good point! I posted without testing it first. Your original syntax was correct and my correction was incorrect. You should use [fix_zero, suppress_zero] instead of [fix_zero][suppress_zero].