cancel
Showing results for 
Search instead for 
Did you mean: 

target node need to be repeated based on the output value of the UDF

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Yes. My UDF returning values with context changes. i can see that in the target node queue. im also having the target node occurance is 0..unbounded

Regards,

Ramalakshmi.G

Former Member
0 Kudos

Can you give the snapshot of the Display Q on your UDF and Display Q of you target node

I guess you need to use remove context for Node mapping, and map as it is or split by value for the dat value mapping

PriyankaAnagani
Active Contributor
0 Kudos

Hi

>>>Yes. My UDF returning values with context changes. i can see that in the target node queue. im also having the target node occurance is 0..unbounded

Use remove context...

UDF>removeContext>targetNode

Regards

Priyanka

Former Member
0 Kudos

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

Former Member
0 Kudos

Try using removecontext while mapping to target node

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Rama,

You query doesnot have the restriction on the number of records to be picked up, that is no condition.

On what condition do you want to fetch record? Based on the condition you can modify your query and enter the condition next to where

regards

Ramesh

Former Member
0 Kudos

what exactly is your requirement for the SELECT....you can always keep a null value check if you dont want to execute the SELECT for an empty value.....

Former Member
0 Kudos

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.

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

>>>And it UDF is running for Context Change also.

Try with removing the context before calling the UDF or try with AllValuesOfQueue

Regards,

Priyanka

Former Member
0 Kudos

Use the same technique pass the source value by applying removecontext

Former Member
0 Kudos

I tried with these possiblities. Still its calling UDF for context change also.

justin_santhanam
Active Contributor
0 Kudos

is it possible for you to show a screenshot of how the input queue and output queue of the UDF looks like?

Justin.

Former Member
0 Kudos

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

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

>>>But the target node Student is not repeating

what is the occurrence of student node...it should be 0...unbounded

Regards,

Priyanka

Former Member
0 Kudos

Hi,

Have you checked the occurance of the target message type?

Is it 0...Unbounded? Make sure it is 0....Unbounded.

Regards

Ramesh