Removing non-alphanumeric characters using Convert function
Moderators: chulett, rschirm, roy
Removing non-alphanumeric characters using Convert function
I am trying to remove all non-alphanumeric characters from a string. Two questions:
1)How do you do:
Convert("""", MyString)?
This does not compile. Gives a validation error.
2)Is there any way to do it in PX without writing a routine? I went through all the posts here but I don't see a PX solution.
1)How do you do:
Convert("""", MyString)?
This does not compile. Gives a validation error.
2)Is there any way to do it in PX without writing a routine? I went through all the posts here but I don't see a PX solution.
Convert() requires three arguments.
Try something like
That should be close.
Try something like
Code: Select all
Convert("~!@#$%^&*()_+=-`,./;[]\|}{:?>< ", "", in.Col)
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
DSGuru2B, thank you for your response. Yes, I am aware that Convert requires 3 arguments. I made a mistake in my first post. I was already doing the exact same thing that you posted. The error happens because of the 2 double quotes.
If I put in a double quote as follows:
Convert("~!@#$%^&*()_+=-`,./;[]\|}{:?>< "", "", MyString)
it gives a validation error. I tried putting in 2 double quotes together so that the compiler translates into one but it also gives the same validation error.
Also, I was looking for a solution that would also take care of all non-alphanumeric characters including non-printable characters.
If I put in a double quote as follows:
Convert("~!@#$%^&*()_+=-`,./;[]\|}{:?>< "", "", MyString)
it gives a validation error. I tried putting in 2 double quotes together so that the compiler translates into one but it also gives the same validation error.
Also, I was looking for a solution that would also take care of all non-alphanumeric characters including non-printable characters.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
There are three quote characters available. Surround the string with one of the others. Concatenate if you must.
The first piece is a double quote character surrounded by single quote characters, the second piece is a single quote character surrounded by double quote characters.
Code: Select all
Convert('"':"'", "", InLink.TheString)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Try this: Put an external filter and use unix command in your job to strip non alphanumeric characters
Last edited by JoshGeorge on Mon May 07, 2007 2:25 am, edited 1 time in total.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Use OCONV/ICONV with MCP format to convert all nonprintable characters to a dot. Then use the above convert statement to extract only alphabets and numers.ady wrote: Ray , How can we do it in basic transformer without a routine ?
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.