Siebel – Left, Right and from the Middle
by Nitin JainExtracting a sub string from a lengthy string in Siebel. What is the best solution you can think up for this typical problem? I know, I know, you and you colleagues have done this thousands of times before. But, have you ever successfully done it without using a single line of scripting?!!
Now, it becomes interesting!
Not that I am saying, it’s entirely possible only by configuration. At the very least I don’t know how it’s possible that way.
Let’s assume a test string:
var strng = “abcdefghijklmnopqrstuvwxyz1234567890″;
Requirement : Take the first 5 characters from the above string in another substring
Solution 1:
var sub_strng = strng.substr( 0,5 );
Output:
abcde
Solution 2 : Using Left() function.
Take it in a Calculated field. Use the expression,
Left( strng, 5 )
Output:
abcde
I have noticed that at times, this does not work within eScript. Should work with VB and in Calculated Expressions.
Requirement : Take the last 5 characters from the above string in another substring
Solution 1:
var sub_strng = strng.substr( (strng.length – 5),5 );
Output:
67890
Solution 2 : Using Right() function.
Take it in a Calculated field. Use the expression,
Right( strng,5 )
Output:
67890
I have noticed that at times, this does not work within eScript. Should work with VB and in Calculated Expressions.
Requirement : Take the middle 5 characters from the above string in another substring (assume ‘cdefg’)
Solution 1:
var sub_strng = strng.substr( 2,5 );
Output:
cdefg
Solution 2 : Using Mid() function.
Take it in a Calculated field. Use the expression,
Mid( strng,2,5 )
Output:
cdefg
I have noticed that at times, this does not work within eScript. Should work with VB and in Calculated Expressions.
Using Calculated Expressions where these are very commonly required, does save scripting at times.
Trust me, this really works!!
Related posts:
- Siebel – InvokeServiceMethod() on Calculated Fields InvokeServiceMethod() is used to invoke Business Services and take values...
- Siebel – Make MVG Field required – II Hi friends, This is a follow-up post of the post...
- Siebel – Make a field Required, conditionally There was a requirement in our project to make Account...
- Siebel – Symbolic Strings – Usage Symbolic Strings appear directly in Siebel Tools’ Object Explorer, an...
- Siebel – EAI Siebel Adapter Search Spec Hi, I can bet that for anybody who has worked...
- Siebel – ActivateField() split wide open In Siebel, we generally tend to use the fields on...
- Siebel – Make MVG Field required Siebel supports the concept of Multi Valued Fields, or the...
I remember being mocked at once over this issue.
Somebody said, “hey, listen to what garb Nitin is talking about. He is talking about some Left and Right in Siebel..!!”