Showing results for 
Search instead for 
Did you mean: 

BODS custom function, issue while returning text value.

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (2)

Answers (2)

Active Contributor
0 Kudos

That means your Return Value Datatype is still set to int. Make sure to set it to varchar.

There may be a repository corruption though. If it doesn't work, try to exit DS Designer and try again. If still no success, delete your function and create it again.

0 Kudos

This is a custom function while you have made it as validation function.

mark it as Custom and it should work.

Shiva Sahu