Skip to main content

Posts

Showing posts with the label replace

How to remove Line Breaks from a string using Siebel eScript

In Siebel if you copy the value from field (which have line break character) and paste in notepad it will look fine, but when you use query step in workflow or script and check the logs, the search spec will have a large white space due the line break character stored in data base of that specific column and query will not work. For removing line breaks in a field you can use below eSciprt. Line breaks in strings Windows: \r\n carriage return followed by newline character. Linux: \n just a newline character. Regular Expression: if(MethodName == "Remove LB CR")     {         var vTemp = Inputs.GetProperty("vIn");         vTemp = vTemp.replace( /[\r\n]+/gm, "");         Outputs.SetProperty("vOut",vTemp);         return (CancelOperation);     }   See Also: How to remove Line Break when selecting data from SQL Server

How to remove Line Break when selecting data from SQL Server

When you run SELECT query and copy the result to notepad or excel instead of one row columns with new line character shifts to new row. char(13) is carriage return (is a control character or mechanism used to reset a device's position to the beginning of a line of text) and char(10) is line feed (new line). Below query will eliminate carriage return and new lines from a column of a table. The inner replace replaces line feed and the outer replace replace carriage return SELECT Replace ( Replace( X_DIVISION, CHAR (10), '' ), CHAR (13), '' ) FROM S_CASE_X WHERE PAR_ROW_ID = '1-8I4G98D' Source: Stackoverflow 28628342, Wikipedia See Also: How to remove Line Breaks from a string using Siebel eScript

How to create Business Service in Siebel

Create new record in Business Service, provide appropriate name and project. Create new record in Business Service Method, provide appropriate method name. Expand Business Service Method and create new records in Business Service Method Arguments and select Type as Input and Output. Right Click on Business Service name and click on Edit Server Scripts. In Service_PreInvokeMethod write your script. function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if(MethodName == "SET") { var IP = Inputs.GetProperty("in"); //Input Property name defined in Business Service Method Arguments var rep = /(-)/g; IP = IP.replace(rep , ""); Outputs.SetProperty("out", IP); //Output Property name defined in Business Service Method Arguments return (CancelOperation); } return (ContinueOperation); } Save, Compile and Test.

How to remove special character from a string through Siebel eScript

I have created a simple Business Service, which takes single input and check if that string contain "-" and it will remove and return the final value in output argument. Below is the script: var IP = Inputs.GetProperty("in"); var rep = /(-)/g; IP = IP.replace(rep , ""); Outputs.SetProperty("out", IP); How to create Business Service in Siebel