Quantcast
Channel: Data Services and Data Quality
Viewing all articles
Browse latest Browse all 236

Custom function in BODS to remove special characters from a string

$
0
0

Below is step by step procedure to write a custom function in BODS to remove special characters in a string using ASCII values.

 

Step 1: Create a custom function in BODS and name it as 'CF_REMOVE_SPECIAL_CHARS'

 

Step 2: Use the below code in your function.

 

fun.png

 

Step 3: Declare Parameters and local variables as shown in left pane of the above function editor.

 

$input_field - parameter type is input (data type varchar(255) )

$L_Char - datatype varchar(255)
$L_Counter - datatype int
$L_String - datatype varchar(255)
$L_String_final - datatype varchar(255)
$L_String_Length - datatype int


Step 4: Save this function.

 

Step 5: Call this function while mapping any field in Query Editor where you want to remove special characters.

 

Ex: CF_REMOVE_SPECIAL_CHARS(Table1.INPUT_VAL)

 

Above function call shall remove all special characters from INPUT_VAL field in a table1 and output Value shall look like below table's data.

 

TBL.png


Viewing all articles
Browse latest Browse all 236

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>