Author |
Message
|
sibcool |
Posted: Wed Apr 23, 2008 12:56 am Post subject: ESQL - string manipulation |
|
|
Novice
Joined: 17 Mar 2008 Posts: 20
|
What would be the best to determine if a string has alphanumeric characters or not before a mapping in ESQL? |
|
Back to top |
|
 |
Gaya3 |
Posted: Wed Apr 23, 2008 1:03 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
AFIK it treats as string only...couldnt be any issues
Regards
Gayathri _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2008 1:29 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Gaya3 wrote: |
couldnt be any issues
|
Unless the mapping isn't to a series of string targets. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2008 1:30 am Post subject: Re: ESQL - string manipulation |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sibcool wrote: |
What would be the best to determine if a string has alphanumeric characters or not before a mapping in ESQL? |
Define a message set which describes the message, and validate that. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sibcool |
Posted: Wed Apr 23, 2008 1:48 am Post subject: |
|
|
Novice
Joined: 17 Mar 2008 Posts: 20
|
Currently do have message sets - but get parsing error when mapping to the OutputRoot MRM. I can't just cast as the business users want any of the codes (stirngs) coming in with alphas set to 0 in the output field.
Last edited by sibcool on Wed Apr 23, 2008 1:57 am; edited 1 time in total |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2008 1:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sibcool wrote: |
Currently do have message sets - but get parsing error when mapping to the OutputRoot MRM. I can't just cast as the business users want any of the codes coming in with alphas set to 0 in the output field. |
So your requirement is that the input message matches the actual input at a structural level, but you need to apply business logic such that a selected field containing alpha characters is mapped to a 0 on the output, and your issue is that on performing such a mapping you get a parsing error?
Is my analysis correct? How is the input field(s) in question defined? How are the output field(s) defined? Are you performing a straight assignment one to the other? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
sibcool |
Posted: Wed Apr 23, 2008 2:07 am Post subject: |
|
|
Novice
Joined: 17 Mar 2008 Posts: 20
|
Input field is string and the Output target element short (provided by external source). Am doing a straight forward mapping via ESQL. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2008 2:32 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
sibcool wrote: |
Input field is string and the Output target element short (provided by external source). Am doing a straight forward mapping via ESQL. |
If you can't do a cast (as you say earlier) then you've got problems. I'd cast it.
If you're on v6 or later you could do this is Java and use the checking in that.
Unless there's additional checking / validation in v6 / v6.1 I've not come across yet. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Gaya3 |
Posted: Wed Apr 23, 2008 2:42 am Post subject: |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
whats the message format, and how the string looks like
could you please place an eg over here...
Regards
Gayathri _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
sibcool |
Posted: Wed Apr 23, 2008 2:55 am Post subject: |
|
|
Novice
Joined: 17 Mar 2008 Posts: 20
|
Postal codes really - so the external to which I send the data gave us a message set definition with the output field of type short. So everything is fine with input like '2000' or '2195' or '9459' etc. But from the backend systems (4) where the data comes from, input like 'x001' etc is a possibility.
RE: the Java
Thought of using this route but the way the system has been built is that everything is ESQL so going Java would break the current practices. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 23, 2008 3:45 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I would tend to TRANSLATE any numeric characters into '', and see if I have any characters left. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sibcool |
Posted: Wed Apr 23, 2008 4:38 am Post subject: |
|
|
Novice
Joined: 17 Mar 2008 Posts: 20
|
Giving the translate approach a try. |
|
Back to top |
|
 |
Bartez75 |
Posted: Wed Apr 23, 2008 6:56 am Post subject: |
|
|
 Voyager
Joined: 26 Oct 2006 Posts: 80 Location: Poland, Wroclaw
|
Quote: |
Currently do have message sets - but get parsing error when mapping to the OutputRoot MRM. I can't just cast as the business users want any of the codes (stirngs) coming in with alphas set to 0 in the output field. |
Quote: |
Input field is string and the Output target element short (provided by external source). Am doing a straight forward mapping via ESQL. |
Isn't it possible to check character by character and if it is not number change it to '0'? Then if inputField='12a34' then outputField='12034' |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 23, 2008 6:59 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Bartez75 wrote: |
Isn't it possible to check character by character and if it is not number change it to '0'? Then if inputField='12a34' then outputField='12034' |
By coding a loop instead of a single statement, yes.
If I've read the requirement here correctly, the desired result is:
If InputField="12a34" then OutputField = "0", which is a simpler proposition. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
madi |
Posted: Wed Apr 23, 2008 7:07 am Post subject: |
|
|
 Chevalier
Joined: 17 Jan 2006 Posts: 475
|
may be the requirement is to check if its an alpha numeric and not a particular alpha numeric if that makes sense
--madi |
|
Back to top |
|
 |
|