on 11-09-2006 4:34 PM
Hi all,
I'm trying to put an incomming array of strings into a simple element. How can I do it with XI? The scenario is like this. I have data repository with software metrics data. In XI, there is a Web Service (sender) and a JDBC (receiver). The client application calls the Web Service, with a request "params" message:
<MetricsReportRequest>
<SystemName>Sytem1</SystemName>
<SystemName>Sytem2/SystemName>
<SystemName>Sytem3/SystemName>
<Periodicity>tstf</Periodicity>
<Level>fgsdf</Level>
<StartDate>gsdfg</StartDate>
<EndDate>sdfg</EndDate>
</MetricsReportRequest>
Then, there is a mapping to transform the incomming message to the JDBC "SQL_QUERY" message:
<MetricsReportJDBCMessageType>
<STATEMENTNAME>
<MY_TABLE ACTION="SQL_QUERY">
<ACCESS>SELECT FIELDS FROM MY_TABLE WHERE SYSTEMNAME in ($systemName$) and (DATE > to_date($startDate$,'yyyy-mm-dd') and DATE to_date($endDate$,'yyyy-mm-dd'))
</ACCESS>
<KEY>
<startDate>01/01/2001</startDate>
<endDate>01/01/2002</endDate>
<systemName>'Sytem1','Sytem2','Sytem3'</systemName>
</KEY>
</MY_TABLE>
</STATEMENTNAME>
</MetricsReportJDBCMessageType>
The problem is that I couldn't find a way to transform this
<SystemName>Sytem1</SystemName>
<SystemName>Sytem2/SystemName>
<SystemName>Sytem3/SystemName>
to this
<systemName>'Sytem1','Sytem2','Sytem3'</systemName>
Or, If someone has any other solution to query the data, would be very apreciated.
Thanks!
roberti
Hi Waldemar,
try to create a UDF (queue) with only one parameter (inputQueue) with the following code:
//******************************************************************************
ArrayList content = new ArrayList();
StringBuffer sbResult = new StringBuffer();
for(int i=0;i<inputQueue.length;i++)
{
if(!inputQueue<i>.equals(ResultList.CC) && !inputQueue<i>.equals(ResultList.SUPPRESS))
{
sbResult.append(inputQueue<i>);
sbResult.append(",");
}
}
result.addValue(sbResult.toString().substring(0,sb.length() - 1));
//******************************************************************************
Hope this help,
Regards
Francesco
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Francesco,
This was the solution for the problem
I corrected some details, but it solved the problem.
I didn't know that in the queue mode the "string" parameter were an array, this was the point.
Thank you very much!
cheers!
roberti
ps.: I don't know how to give you points... the buttons to give points disappeared from the page...
Is possible to solve the problem creating a user defined function, typed as queue. This type of function allows to use an array as input parameter, then, looping on the array is possible to create a unique string.
roberti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create UDF on context. Loop over it and concatenate it.
Regards,
Wojciech
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You should select correct type of function.
1) functional (only strings as parameters)
2) context (context as parameter) array
3) queue (queue as parameter) array
In old service packs you had to select something like "queue cache" or a little bit different.
regards,
Wojciech
Message was edited by: Wojciech Gasiorowski
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.