ABC=8
DEF=9
XYZ=0
I am inputting value such as
('ABC',2,3)
so I need to get 88.888
or
('DEF,5,2)
so I need to get 99999.99
How do I do this, this is what I got so far ...
I am building this inside the DataServices Functions smart editor menu
###################################################################
################################
###################################################################
# FN_Default_TEST($p_DefaultType, p_left_of_deci, p_right_of_deci)
# p_DefaultType will be 'NAP' for Not applicable and 'NAV' for Not Available and 'NAZ' for 0 filled
# p_left_of_deci will be the numbers to the left of the decimal point
# p_right_of_deci will be the numbers to the right of the decimal point
$v_Default8 = '8888888888888888888888888888888888888888888';
$v_Default9 = '9999999999999999999999999999999999999999999';
$v_Default0 = '0000000000000000000000000000000000000000000';
$v_TempString = decode
(($p_DefaultType = 'ABC'), $v_Default8,
($p_DefaultType = 'DEF'), $v_Default9,
($p_DefaultType = 'XYZ'), $v_Default0,
null);
$v_Max_Len = $p_left_of_deci
$v_DataScale = $p_right_of_deci
if ($v_DataScale > 0)
$v_ReturnString = substr ($v_TempString, 1, $v_Max_Len - ($v_DataScale + 1 )) || ',' || substr ($v_TempString, 1, $v_DataScale );
else
$v_ReturnString = substr ($v_TempString, 1, $v_Max_Len);
print($v_ReturnString)
###################################################################
################################
###################################################################