Return values if they have a space ' ' ELSE don't return it
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 23
- Joined: Tue Aug 04, 2015 12:45 pm
Return values if they have a space ' ' ELSE don't return it
Can anyone provide guidance on creating an equation that will return values if a space exists in the field?
e.g. if you have the following values:
100 hits
strikeout
right field
shortstop
The returned values would be '100 hits' and 'right field'
e.g. if you have the following values:
100 hits
strikeout
right field
shortstop
The returned values would be '100 hits' and 'right field'
-
- Participant
- Posts: 23
- Joined: Tue Aug 04, 2015 12:45 pm
-
- Participant
- Posts: 23
- Joined: Tue Aug 04, 2015 12:45 pm
Scroll down to the Index function in the URL below for the syntax. You'll need to copy/paste the whole thing as it is not clickable here, unfortunately.
Something like this perhaps, adjust as you see fit:
http://www-01.ibm.com/support/knowledge ... tions.html
Something like this perhaps, adjust as you see fit:
Code: Select all
If Index(lnk_Cast.BASEBALL," ",1) = 0 then <space not found logic> else <space found logic>
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 23
- Joined: Tue Aug 04, 2015 12:45 pm
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
This really only needs to be an output link constraint expression in a Transformer stage. There is no need for If..Then..Else.
Code: Select all
Index(lnk_Cast.BASEBALL, " ", 1) > 0
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.
Of course but the other syntax is usually easier for beginners to understand. Besides, who said anything about a output link constraint expression?
Tweak like so to treat the result as a Boolean:
Tweak like so to treat the result as a Boolean:
Code: Select all
If Index(lnk_Cast.BASEBALL," ",1) then <space found logic> else <space not found logic>
Last edited by chulett on Thu Aug 27, 2015 7:26 am, edited 1 time in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Premium Member
- Posts: 1735
- Joined: Thu Mar 01, 2007 5:44 am
- Location: Troy, MI
with a little correction
one should be "space not found logic" as it is an if-else block
Code: Select all
If Index(lnk_Cast.BASEBALL," ",1) then <space found logic> else <space not found logic>
one should be "space not found logic" as it is an if-else block
Priyadarshi Kunal
Genius may have its limitations, but stupidity is not thus handicapped.
Genius may have its limitations, but stupidity is not thus handicapped.