on 02-26-2019 7:17 AM
Hi
I need a udf (Groovy Script)to fetch all the value in string which comes before thirsd "|".. for eg if the value is coming "CRN-YB20-DNB-SEPSDK|3Fcomp|3Dmp|4mp6|io90 .. then fetch the value before 3rd "|" so result will be
CRM-XB10-DNB-SEPSDK
3Fcomp
3Dmp..
note - | may or may not come in string and All value should come in queue
All value should come in queue
Hi Anurag
What you need is fairly simple to accomplish in Groovy. Take a look at the following:
def void splitByPipe(String[] input, Output output, MappingContext context) {
input[0].tokenize('|').take(3).each { t ->
output.addValue(t)
}
}
The tokenize('|') method splits the input string, using the pipe as the delimiter. The take(3) method returns a new List, containing the first three elements of the List returned by tokenize('|'). The resulting strings are added to the queue.
Regards,
Morten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.