Hi,
I am trying to get logic to filter out only those records from my input whose left most character starts with any alphabets or any number.
example
* xyz
abc
2 gt
@yt
i want to output only abc and 2 gt.
Please advice
thanks
need logic to filter
Moderators: chulett, rschirm, roy
Use this as your transformer constraint
Code: Select all
Convert("abc..xyz0123456789","",input[1]) = ""
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I would prefer to use the Left() function, as it's self-documenting.
If you need to handle upper-case letters too, simply wrap the input column reference with a Downcase() function.
Here I've used the Len() function because, under the covers, 1 is used directly to represent "true" and 0 to represent "false".
If you need to handle upper-case letters too, simply wrap the input column reference with a Downcase() function.
Code: Select all
Len(Convert("abcdefghijklmnopqrstuvwxyz0123456789", "", Downcase(Left(InLink.TheString,1))))
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: 91
- Joined: Wed Apr 20, 2005 7:59 pm
- Location: U.S.
Hi,
I would use a combination of Stage Variable and Constraint to handle this issue.
First define a Stage Variable as follows: AlNumCheck=Left(AlNum(InputColumn), 1). This is going to return a True/False (1 for true and 0 for false) indicator if the first value is AlphaNumeric or not.
Second use the Constraint to pass only the rows with AlNumCheck=1.
This way you will get what you are looking for.
Hope this helps.
I would use a combination of Stage Variable and Constraint to handle this issue.
First define a Stage Variable as follows: AlNumCheck=Left(AlNum(InputColumn), 1). This is going to return a True/False (1 for true and 0 for false) indicator if the first value is AlphaNumeric or not.
Second use the Constraint to pass only the rows with AlNumCheck=1.
This way you will get what you are looking for.
Hope this helps.