cancel
Showing results for 
Search instead for 
Did you mean: 

DB lookup response mapping

Former Member
0 Kudos

My question is actually really simply,

Suppose I have a UDF and I want to make a

SELECT name, last_name FROM employee WHERE id = id1

the input is id1 but how do I deal with two outputs when the result can only be 1 string?

I could save it to a global container, but the question is at the end how to map it to the response, or what am I not understanding here?

(without using Graphical JDBC lookups)

request response

msg msg

id1---> UDF --->name -


> name

->last name--> last name

Thanks a lot!

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

JDBC Graphical lookup is user friendly. You can avoid these problems.

In your case, YOu return single string. suggestion. Concatanete first name and last name using separtor and return as one string. After return use some standard java function to split the string in to first and last name.

Snippet code
// in your jdbc udf 
String concat=firstName+":" +lastName;
return concat;

When you map the string to target fields ...

Create UDF or use text functions to achieve this


int pointer = concat.indexOf(":");
firstName = concat.substring(0, pointer);
lastName = concat.substring(pointer+1);

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks for your answers,

What I was actually looking for, and could find was that it is possible to return 2 objects ResultList from a UDF, which I didn't know.

maciej_jarecki
Contributor
0 Kudos

Hi,

UDF is typical java method and mapping is a class. So in MM go to Function tab and in init method create some variable. Then in your udf you can assign this variable using:

this.var1 = value;

and than reuse it later in other udf.

Kind Regards

Maciej