cancel
Showing results for 
Search instead for 
Did you mean: 

Create node for every unique combination of values

Former Member
0 Kudos

Hello

I have a specific requirement where i need to create a target node based on two fileds of the source node. For every unique combination of these two fileds i need to create a node in the target.

for example

Line1

F1

F2

Line2

F1

F3

Line3

F4

F5

Line4

F1

F2

In the target i need a node T 3 times , as there are only 3 unique combinations of fileds (F1,F2) (F1,F3) (F4,F5). My target should be T[1] , T[2], T[3] 3 times only.

How can i achieve this .any help is greatly appriciated.

Thank you.

Accepted Solutions (0)

Answers (4)

Answers (4)

santhosh_kumarv
Active Contributor
0 Kudos

Adding few poits to Ravi's solution.

1. Set the context of element containing value F1, F2,F3 so on from Line node to its parent node.

eg: for a structure as below default context of value will be @ Line insted replace it to root, you can also use removeContext function for this.

root

--Line

---Value

2. Map the output of Split By Value standard function to collapseContext standard node function and then to target node.

so ur mapping will ne like

fieds(1&2)--> concat --> sort ---> splitByValue --> collapseContext ---> target node.

~SaNv...

Former Member
0 Kudos

Thanks collapse context is missing , thats why i couldn't map. I have another requirement , i didn't mention as i didn't want to confuse further. now that the intial problem is solved.

I have another filed say V

for example

Line1

F1

F2

V1

Line2

F1

F3

V2

Line3

F4

F5

V3

Line4

F1

F2

V4

now from the previous condition there will be three T nodes T[1] for Line1 & Line2 ( as F1 and F2 are same) T[2] for Line 2 T[3] for Line3. Now inside node T i need a node say S wihch is dependednt on V . So T[1] should have two S nodes ( as there are two unique values of V.

How can i achieve this.

I hope i am clear . anyone please help.

Thank you .

Former Member
0 Kudos

Hi Santosh & ravi kanth

Any thoughts on how to achieve my requirement above please ?

santhosh_kumarv
Active Contributor
0 Kudos

I guess sort by key & formatByExample node function can help you to do this...

~SaNv...

Former Member
0 Kudos

Hi Santosh

Could you be a bit more detailed please? I will rephrase my requirement , i think i gave slightly wrong requiremnt.

I have another requirement , i didn't mention as i didn't want to confuse further. now that the intial problem is solved.

I have another filed say V

for example

Line1

F1

F2

V1

Line2

F1

F3

V2

Line3

F4

F5

V3

Line4

F1

F2

V4

now from the previous condition there will be three T nodes T[1] for Line1 & Line2 ( as F1 and F2 are same) T[2] for Line 3 T[3] for Line4. Now inside node T i need a node say S wihch is dependednt on V . So T[1] should have two S nodes ( as there are two unique values of V.

output:

T[1]

S1

S2

T[2]

S3

T[3]

S4

Hope i made it a bit more clear

How can i achieve this please

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

removing my post, solution is already given by the poster above.

Edited by: Mark Dihiansan on Nov 26, 2009 12:36 PM

former_member181962
Active Contributor
0 Kudos

Hi,

case 1: The two fields are like, One Field2 is One level below the Field 1.

In this case, you just need to take the field2-> remove Contexts> Map to the target node.

Case2: The two fields are at same level.

1) Concatenate them.

2) Sort the concatenate value.

2) Use Split by value (At New Value>

4) Map to the target node.

Regards,

ravi Kanth talagana

Former Member
0 Kudos

Hi Ravi kanth

I tried your solution. But it is creating only one node instead of 3. I checked the display queue at split by value and there are 3 context changes but only one node is produced. i am doing something wrong ?

Thanks

Former Member
0 Kudos

Hi,

Using sort and SplitByValue (at value change) node functions could make it ... You may have to tweak the context to achieve your target mapping

Rgds

Chris