cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping multiple node's value to single field by some conditions

Former Member
0 Kudos

Hello All

Case: There is 0..n node in message. I need to get one field and map it to destination field but from one specific record in that node (i.e. satisfying some logical conditions based on other fields). How to create such mapping?

TIA

Best Regards

Maciej

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Still doesn't work for multiple node elements...

When I have only one source element - logic works fine. But when there is more than one element in source collection - it still takes only first element under consideration. If the first element doesn't satisfy condition, the second one does - still only first is taken and mapping returns empty string...

How to make it work for whole collection?

Logic is built on two date comparators, one AND block and IF block which puts either empty string or value from source depending on conditions.

Regards

Maciej

Former Member
0 Kudos

Hi.

How do you put your logic.? Put after UDF remove context.

Former Member
0 Kudos

Hi.

How do you put your logic.? Put after UDF remove context.

Former Member
0 Kudos

That's how my logic looks like:

http://yfrog.com/11mappingj

I've noticed one more thing that seems to be wrong: in queuea of both DateAfter/Before CurrentDate is only single value in input queue, but validFrom/To are multiplied (correct, as there are many records in input data).

Maybe I'm using some wrong approach to whole thing?

What I need to do is map field "symbol" to some destination field, choosing "symbol" from record which meets date based condition...

Any help will be appreciated

Regards

Maciej

Former Member
0 Kudos

Redundant post, sorry for mess.

Former Member
0 Kudos

Hi Macied.

Can you put your source and target and the occurrence or an litle example.

Like this.

source1 0.......Unbounded

datefrom

dateto

.....

Target

datefrom

dateto

.....

Former Member
0 Kudos

Source structure:

Message 1..1

Datatype1 1..1

attr1

attr2

...

Datatype2 0..n

validFrom

validTo

symbol

Destination structure:

JDBC XML SQL message, where node ACCESS is 1..1 and there is attribute

Distributionsymbol 1..1 which is target for this mapping. There is no vf/vt in target structure, I just nieed to choose correct value from source and map it.

Regards

Maciej

Former Member
0 Kudos


Datatype2 0..n
validFrom
validTo
symbol

Destination structure:
JDBC XML SQL message, where node ACCESS is 1..1 and there is attribute
Distributionsymbol 1..1 which is target for this mapping. 
There is no vf/vt in target structure, I just nieed to choose correct value 
from source and map it. 

in your source the node 1..1 and you have in your source multiple node. this no posible you need to

change the occurrence in your target.

Former Member
0 Kudos

It seems to me that we have some misunderstanding here.

I have 1..n node in source. And I need to select the only one record from this node and map it's attribute to 1..1 target node.

Regards

Maciej

Former Member
0 Kudos

Well in this case. Use copyvalue

Constant.........>> Node

"Your below logic"-->> CopyValue(0)--


>>Distributionsymbol

former_member200962
Active Contributor
0 Kudos

what are the conditions....there could be n number of assumptions for your requirement!

Former Member
0 Kudos
Datatype1:
 field
 date_from
 date_to
 status 

Field is to be mapped and condition is: sysdate between date_from and date_to

Possibly combined with some status value.

Regards

Maciej

Former Member
0 Kudos

Hi

you can use Graphical Functions but is litle complicate or an UDF like example.


 DateFormat df = new SimpleDateFormat ("yyyy/MM/dd");
 Date datenow = new java.util.Date();
 String result = "";

  try{
       Date d1 = df.parse(date_from);
       Date d2 = df.parse(date_to);
       if(d1.before(datenow)  && datenow.before(d2))
         result ="true";
  }
 catch(Exception e){
   result = "false";
 }
return result;   

Former Member
0 Kudos

Hi Luis!

Thanks for this suggestion - I'll try it.

Could you give some more info about using graphical functions in this case?

TIA

Regards

Maciej

Former Member
0 Kudos

I've managed to build that logic from graphic function.

Thanks again