cancel
Showing results for 
Search instead for 
Did you mean: 

create node based on the existens of 2 other nodes in UDF

0 Kudos

Hi Guys

I want to create Item node only based on the existence of node let say Node1 and the field F1 which is under Node1.

--- Node1 exists and F1 -----  exists than create the Item node.

F1 is in the context of Node1.

I have tried many things including UDF  but the result is unpredictable

please help

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Samer,

try using the count-function. If I understand it correctly, you'll only want to create target node if all source nodes have Field1.

That way, you compare the number of node-elements with field-elements. If they don't match, the target doesn't get created.

Regards

Thomas

0 Kudos

Hi Thomas and Mark

Thanks for your effort

This is my scenario

1- Node1---------F1

2- Node1---------> no F1

3- Node1 ---------> F1

in this case only 1 and 3 should create the target (Item node)

but in some how also scenario 3 is creating the node Item which it sould not do

Item node has required fields depending on the field F1 , that is why the mapping is failing.

This is what i am using

BR

Former Member
0 Kudos

Hi Samer,

either I still haven't got it yet or it comes down to Mark's solution.

This should do the trick and is basically what Mark said. F1 cannot exist without N1.

Regards,

Thomas

0 Kudos

Grate

Thanks Mark and Thomas

BR

Answers (1)

Answers (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Samer,


I want to create Item node only based on the existence of node let say Node1 and the field F1 which is under Node1.

Just check for the existence of fieldF1, after all when F1 exists it is already implied that Node1 exists

Regards,

Mark

0 Kudos

Hi Mark

Thanks for the replay

I tried that , but whenever we have 2 Node1 , one with F1 and and one without F1 , than the target node is created anyway

I can not change the context because I run into other problems

so thes issue is whenever we have Node1 and F1 , Target node should be created

I tried in advanced UDF , with context , looping at Node1 and inside loop at F1 but F1 will always have value

Arguments Node1 and F1

for(int j=0;j<Node1.length;j++)

{

for(int i=0;i<F1.length;i++)

{

if (!F[j].equals( ""))

{

result.addValue("");

}

}

}

Thanks

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

F1 -> exists -> not -> additional logic.

Does this work? Can we have a screenshot of your mapping? Also give sample input,

Regards,

Mark