Skip to Content
0

BODS custom function, issue while returning text value.

Mar 01, 2017 at 02:05 PM

83

avatar image
Former Member

Hi techies,

I am creating a custom function in BODS to remove special characters from text,

Below is the script,

$L_String =$P_Input_Field; $L_String_Length =length( $L_String ); $L_Counter =1; $L_String_final =null; while($L_String_Length>0) begin $L_Char =substr( $L_String ,$L_Counter,1); if((ASCII($L_Char)>=48 and ASCII($L_Char)<=57) or (ASCII($L_Char)>=65 and ASCII($L_Char)<=90) or (ASCII($L_Char)>=97 and ASCII($L_Char)<=122) or (ASCII($L_Char)=32)) begin $L_String_final =$L_String_final || $L_Char; $L_Counter =$L_Counter+1; $L_String_Length =$L_String_Length -1; end else begin $L_Counter =$L_Counter+1; $L_String_Length = $L_String_Length - 1; end end Print ($L_String_final); ##$L_String_final = 'Test'; Return $L_String_final;

It returns null value as return type is integer,

but if i change the return datatype to varchar it says below two error.

[Function:CF_REMOVE_SPECIAL_CHARS] The script validation function <CF_REMOVE_SPECIAL_CHARS> must return an integer. (BODI-1111402)

[Function:CF_REMOVE_SPECIAL_CHARS] The function <CF_REMOVE_SPECIAL_CHARS> contains an invalid expression. Additional information: <Validation function <CF_REMOVE_SPECIAL_CHARS> should return Integer type.>. (BODI-1111182)

your kind help is appreciated.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers