|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
format with xs:string |
« View previous topic :: View next topic » |
Author |
Message
|
jcv |
Posted: Tue Jul 31, 2007 2:31 am Post subject: format with xs:string |
|
|
 Chevalier
Joined: 07 May 2007 Posts: 411 Location: Zagreb
|
Is it possible to specify format for casting decimal to string, using xs:string function from Mapping node casts group of functions? Thanks. |
|
Back to top |
|
 |
AkankshA |
Posted: Tue Jul 31, 2007 3:13 am Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
|
Back to top |
|
 |
jcv |
Posted: Tue Jul 31, 2007 5:32 am Post subject: |
|
|
 Chevalier
Joined: 07 May 2007 Posts: 411 Location: Zagreb
|
Yes. I tried with: xs:string($source/some_source_element,'###,###,##0.00'), toolkit didn't report any error, but when I tried to deploy the bar, it reported following error:
Syntax error : ';'. : BROKER.f9cdf9a0-0f01-0000-0080-929af9708d91: /build/S600_P/src/DataFlowEngine/ImbRdl/ImbRdlRdp.cpp: 3139: SqlParser::castFunction: ComIbmComputeNode: os_flow#FCMComposite_1_1.ComIbmMapping#FCMComposite_1_1
It was a blind attempt anyway, since I haven't found document explaining signature of xs:string function. I know of possibility to cast with ESQL in a compute node, or with Java, but I would like to solve it in a mapping node. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Jul 31, 2007 5:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
xs:string() is defined at http://www.w3.org/TR/xpath-functions/#casting
You can't specify a pattern to xs:string().
You can call an ESQL routine that will do the conversion for you, instead. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jcv |
Posted: Tue Jul 31, 2007 5:54 am Post subject: |
|
|
 Chevalier
Joined: 07 May 2007 Posts: 411 Location: Zagreb
|
|
Back to top |
|
 |
jcv |
Posted: Tue Jul 31, 2007 9:17 am Post subject: |
|
|
 Chevalier
Joined: 07 May 2007 Posts: 411 Location: Zagreb
|
Just to notify you that your suggestions are not in vain.
I have opened new esql file for a flow, created an ESQL function like this:
Code: |
CREATE FUNCTION format_thousands(IN val DECIMAL) RETURNS CHAR
BEGIN
return CAST(val AS CHAR FORMAT '###,###,##0.00');
END; |
replaced the call
xs:string($source/some_source_element)
with
esql:format_thousands($source/some_source_element)
and got what I expected. One obstacle I have overcame with your help, was to learn the possibility of creating stored ESQL functions intended for use in a mapping node. That was actually two obstacles:
1. I somehow always used to connect ESQL with compute and filter node where esql file is automatically generated when you drag and drop a new node of such types to your flow. Here I have created esql file "manually" by using an adequate option intended for this purpose, and named it after the flow, thus connecting those two files, and all ESQL inserted there was ready to use in that flow.
2. I somehow always wanted to avoid compute (or java) node in favour of mapping node, which is much more consistant to the "spirit" of the tool, where ever is this possible. By that I mean message content transformation without writing code. Knowing this, I will be able to do that even more efficiently, by adding just small portions of ESQL when neccessary. Thanks once again. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|