on 12-08-2011 8:24 AM
Hi Gurus,
I have the requirment to get the multiple records from the DB in UDF based on the single input value. I have to generate multiple occurance of the target node based on the output value of the UDF. I will explain with simple example
My input structure contains single field
Students_details
Classname
Student_details
In my UDF, i have accessing the DB using Database Accessor
The input value for the Classname is 5, then my UDF get all the student details of class 5.
My output structure should be
Student_Det
Student
roll no: 1
name: raj
average: 80
Student
Student
roll no: 1
name: raj
average: 80
Student
Student
roll no: 2
name: rajasekar
average: 40
Student
Student
roll no: 3
name: raja
average:90
Student
Student_Det
But the target node Student is not repeating. i ll get only one node in the output. My source Que contains single Context change. I have try to add the Context change after each value in the UDF using 'result.addValue(ResultList.CC);'
I have tried with Splitby value functionality. still its not repeating.. pls guide me
Regards,
Ramalakshmi.G
Is your UDF returning multiple occurances of data with context changes?
check that by testing your UDF...by writing the output and incorporate the context change..also see the occurance of your target node.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I will give my structure here. Please let me know is anything wrong.
java.util.Map map;
AbstractTrace trace;
trace = container.getTrace();
//MappingTrace trace = container.getTrace();
DataBaseResult resultset = null;
//final String channel_name = "JDBC_RCV_GETInvoiceDetails", VALNOTFOUND = "VALUE_NOT_FOUND";
//Build for SQL Statement
String Query = " ";
//String uniqueid = (toString)Event;
Map rowMap = null;
if (event != null)
{
Query = "select REQUESTID,DATASERVICEID,DATASERVICENAME,DATADELIVERYMETHOD,TARGETFOLDER,TARGETFILENAME,TARGETFOLDERUSERID from table where";
for (int i = 0; i < event.length; i++) {
if (i > 0) Query += " OR ";
Query += " EVENTTRIGID = '" + event<i>;
Query += "'";
}
trace.addInfo (Query);
}
DataBaseAccessor accessor = null;
try
{
Channel Channel = LookupService.getChannel ("Bsystem, ChannelName");
accessor = LookupService.getDataBaseAccessor(Channel);
resultset = accessor.execute(Query);
//trace.addInfo(resultset);
for (Iterator rows = resultset.getRows();rows.hasNext();)
{
rowMap = (Map) rows.next();
var1.addValue((String)rowMap.get("REQUESTID"));
var1.addContextChange();
var2.addValue((String)rowMap.get("DATASERVICEID"));
var2.addContextChange();
var3.addValue((String)rowMap.get("DATASERVICENAME"));
var3.addContextChange();
var4.addValue((String)rowMap.get("DATADELIVERYMETHOD"));
var4.addContextChange();
var5.addValue((String)rowMap.get("TARGETFOLDER"));
var5.addContextChange();
var6.addValue((String)rowMap.get("TARGETFILENAME"));
var6.addContextChange();
var7.addValue((String)rowMap.get("TARGETFOLDERUSERID"));
var7.addContextChange();
}
}
catch (LookupException e)
{
trace.addInfo("Error");
trace.addWarning ("Error during lookup" +e);
}
finally
{
trace.addInfo ("Enter Finally");
try
{
if (accessor!= null) accessor.close();
}
catch(Exception e)
{
trace.addWarning("Error closing Accessor - " + e.getMessage());
}
}
Regards,
Ramalakshmi.G
Thanks for your Reply. The target node is generated correctly using remove context function. But now i have the problem in the Sender side. that is the UDF is running for the empty value also and fectching all the values in the table.
That is my select query constructing like this. Please let me know if any errors in the UDF.
I will give reward points after completion of this issue.
the Query is like this foe empty input
REQUESTID,DATASERVICEID,DATASERVICENAME,DATADELIVERYMETHOD,TARGETFOLDER,TARGETFILENAME,TARGETFOLDERUSERID from FPP_REQUEST_VIEW where
Thanks.
Regards,
Ramalakshmi.G
My select Query
Query = "select REQUESTID,DATASERVICEID,DATASERVICENAME,DATADELIVERYMETHOD,TARGETFOLDER,TARGETFILENAME,TARGETFOLDERUSERID from FPP_REQUEST_VIEW where";
for (int i = 0; i < event.length; i++) {
if (i > 0) Query += " OR ";
Query += " EVENTTRIGID = '" + event<i>;
Query += "'";
}
I gave 'Execution Type' as 'All values of a context'. if i pass the empty value to the input field my select query looks like this.
REQUESTID,DATASERVICEID,DATASERVICENAME,DATADELIVERYMETHOD,TARGETFOLDER,TARGETFILENAME,TARGETFOLDERUSERID from FPP_REQUEST_VIEW where";
If i give a single value to the input, two times the Query will be executed. one time it take the correct input value. And it UDF is running for Context Change also.
How to avoid this.
Yes. Its occurance is 0..Unbounded only.. My input queue contains only one input.. but the output queue contains multiple record.. that also i need to generate from the UDF..
I can see the Queue value as..
11
CC
22
CC
33
CC
44
CC
But still its not prducing multiple target node. I have mapped this roll number to the target node student
Regards,
Ramalakshmi.G
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
>>>But the target node Student is not repeating
what is the occurrence of student node...it should be 0...unbounded
Regards,
Priyanka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Have you checked the occurance of the target message type?
Is it 0...Unbounded? Make sure it is 0....Unbounded.
Regards
Ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.