cancel
Showing results for 
Search instead for 
Did you mean: 

UDF Required

Former Member
0 Kudos

We need to adopt a conversion rule to convert the source field value into target filed value.

Pls find the CR and give necessary inputs.

For numeric fields, the conversion rule is the following:

-> Leading zeros are replaced by blanks in the flat file

-> Negative sign is added to the extreme right of the output field

-> A point and two decimals places are added if not present

in the input

-> All numeric input fields are output as char fields and

right-aligned

Examples:

( In which ever format the input is, output must be as given below).

input --> output

123.45 --> 123.45

123.45- --> 123.45-

00000123.45 --> 123.45

00000123.45- --> 123.45-

00000123 --> 123.00

00000123- --> 123.00-

Thanks and Regards,

Jeevan.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

a lot of your cases can be done with the standard function FormatNum.

Give as parameter #.00

This will:

- remove leading zeroes

- add .00 if not existing

- in case for example 3.456 it will round to 3.46 (is this ok?)

Missing is the "-" sign. Is it always at the last char of the input?

And could you have alpha chars or empty inputs?

Regards

Patrick

Former Member
0 Kudos

Hi Patrick,

Thanks for your quick reply. Every thing is fine except the -ve sign.

Always -ve sign must come on the right side of the output.

Is there any means for this also. Pls do let me know.

Thanks and Regards,

Jeevan.

Former Member
0 Kudos

Hi,

you could do it like that:

if:

Source endsWith (standard function) "-"

then:

Source -> replace "-" with "" -> FormatNum -> concat "-"

else:

Source -> replace "-" with "" -> FormatNum

Regards

Patrick

Answers (0)