Author |
Message
|
RocknRambo |
Posted: Thu Sep 02, 2004 4:25 am Post subject: CR in the Element value |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
hello everybody!!..
how can we remove a CR (carriage return) in the element value if it exists.
ex:
<a>
2113
</a>
<b>
12.213
</b>
the reason I'm behind is. ..I need to get the product of a and b. (a times b). the way I'm approaching is with a TRIM than cast as decimal and get the mulitiplication. but its throwing an error, invalid casting of char to decimal.
any thoughts to share...
thanks in advance.
sanu |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 02, 2004 4:41 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I think it doesn't like that one of your character strings doesn't have a decimal point in it.
You should look again at the specification for a decimal and what counts as a valid string representation. You might have to add ".0" to it.
Also, you can use TRIM to remove any characters, rather than just space. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Sep 02, 2004 5:33 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
sorry my typo.
What I found was...the values for both the elements have decimal point.
a = 2113.00
b= 12.213
and what I also found was...If I manually remove the CR in the element value, its working perfect.
but now, the tricky part is the CR in the element is not ALWAYS. I dont see TRIM doing with job for me to remove CR.
any suggestions.. or the hard way to write a new logic to remove CR if one exits.
thanks in advnace.
sanu |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 02, 2004 8:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, last I knew, you could use TRIM to remove any leading or trailing CRs - without checking to see if they exist first.
But check the documentation for the TRIM function for your version. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Sep 02, 2004 9:42 am Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
hi jeff....
I have gone through the pdf and also tested..it..
the pdf says..we can remove trailing, both leading and trailing singletons can be removed.
so its only removing the spaces.
[/img] |
|
Back to top |
|
 |
PGoodhart |
Posted: Thu Sep 02, 2004 10:06 am Post subject: |
|
|
Master
Joined: 17 Jun 2004 Posts: 278 Location: Harrisburg PA
|
Ok, my guess is you are not specifying the singleton. Here is an example from the help files:
TRIM('b' FROM 'bbbaaabbb')
returns 'aaa'.
Because Jeff is right, that's the way it works... _________________ Patrick Goodhart
MQ Admin/Web Developer/Consultant
WebSphere Application Server Admin |
|
Back to top |
|
 |
RocknRambo |
Posted: Thu Sep 02, 2004 3:45 pm Post subject: |
|
|
Partisan
Joined: 24 Sep 2003 Posts: 355
|
yes ur correct...
I was able to achieve by
TRIM(LEADING newline FROM InputRoot tree....)
thanks for both of u
sanu |
|
Back to top |
|
 |
|