How to Remove Special Characters from String in Peoplecode
You can remove special characters from string by use Substitute function by peoplecode
For example 1 is create function remove special
Function RemoveSpecial(&Textdescr)
&Textdescr = Substitute(&Textdescr, “*”, “”);
&Textdescr = Substitute(&Textdescr, “^”, “”);
&Textdescr = Substitute(&Textdescr, “~”, “”);
&Textdescr = Substitute(&Textdescr, “|”, “”);
&Textdescr = Substitute(&Textdescr, “&”, “”);
&Textdescr = Substitute(&Textdescr, “>”, “”);
&Textdescr = Substitute(&Textdescr, “<“, “”);
&Textdescr = Substitute(&Textdescr, “.”, “”);
&Textdescr = Substitute(&Textdescr, “-“, “”);
/*– more statment –*/
End-Function;
For example 2: You create peoplecode at action saveprechang or savepostchange
SQLExec("UPDATE PS_TESTS SET KTB_DESCR1 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TEST_DESCR1, CHR(10), ''), CHR(13), '') , CHR(09), ''),'""',''),'','') WHERE TEST_SIC_YEAR= :1 AND EMPLID = :2 AND TEST_SIC_GRP = :3 and TEST_INT_RC= :4", TEST_EMP_RANK.TEST_SIC_YEAR, TEST.EMPLID, TEST.TEST_SIC_GRP, TEST.TEST_INT_RC);