cancel
Showing results for 
Search instead for 
Did you mean: 

Creating node based on condition

Former Member
0 Kudos

Hi All,

I have a requirement , I have to create a node based on condition , the scenario is as follows:

Target Node:

ListOfStructuredNote (parent node) (0 to unbounded)

ItemStructuredNoteID (hardcoded to Temp)(1:1)

ItemStructuredNote(mapped to /ORDERS02/IDOC/E1CUCFG/E1CUVAL/CHARC_TXT)(1:1)

condition 1: now the I have to generate this node only when I have E1CUCFG segment in the source and also the target node has to be under the correct item ( i.e source has many E1EDP01 segments , based on that we are creating target node "Item" ).

condtion 2: The E1CUCFG has element "POSEX" (/ORDERS02/IDOC/E1CUCFG/POSEX) and also E1EDP01 "POSEX" (/ORDERS02/IDOC/E1EDP01/POSEX)

so when these match then only the source node (ListOfStructuredNote) has to appear under that particular "Item"

Regards

Kiran

Accepted Solutions (0)

Answers (2)

Answers (2)

PriyankaAnagani
Active Contributor
0 Kudos

Hi,

>>>I have to generate this node only when I have E1CUCFG segment in the source

Use CreateIf node function for creating node based on condition.

Ex:

E1CUCFG>exists>createIF--->yourTargetNode

For further mapping help please try to post your source and expected target structures.

Regards,

Priyanka

Former Member
0 Kudos

Hi ,

Thanks ...yeah hope it was that simple... infact that will create the node and its elements .....thats one part of it ...

This is structure:

Source Structure

-


Idoc

Orders

....

......

.....

E1EDP01

POSEX (element of E1EDP01)

......

......

E1CUCFG

POSEX(element of E1CUCFG)

......

E1CUVAL(child node of E1CUCFG)

CharText(element of E1CUVAL)

value text(element of E1CUVAL)

Target

-


Header

.........

Item (this is mapped to E1EDP01 ..this will occur many times E1EDP01 segment appears)

....

...

.....

ListOfStructuredNote (child node of Item)

ItemStructuredNoteID(child element of ListOfStructuredNote) (hardcoded to Temp)

ItemStructuredNote(child element of ListOfStructuredNote) (concat char text and value text of Idoc)

condition is E1CUCFG>exists>createIF--->yourTargetNode (perfect !!!!) but the main condition is

for example if there are 4 E1EDP01 segments ..it will created 4 items at the target ..let the E1EDP01/POSEX have values 001,002,003,004 .

Then if E1CUCFG exsits and it has POSEX take 003 , then the "ListOfStructuredNote" should appear in that Item , that is creating lot of problem...might be its simple or something tricky ....I have tried this condition as well

(if) E1EDP01/POSEX (EQUALS) E1CUCFG/POSEX (then) Create "ListOfStructuredNote" it does not create anything not sure why...if i just give E1CUCFG>exists>createIF--->yourTargetNode it will appear in the first "item" ...

Regards

kiran

..

0 Kudos

<<< E1EDP01/POSEX (EQUALS) E1CUCFG/POSEX (then) Create "ListOfStructuredNote" it does not create anything not sure why...if i just give E1CUCFG>exists>createIF--->yourTargetNode it will appear in the first "item" ... >>>

Hi Kiran, are you sure, you are using the equalS function under text (String) function group?. You condition should work though!

Former Member
0 Kudos

Hi,

Yess I am using string (equals) or else if I use boolean it will throw error....not sure though why its not working....any ideas of doing it in any other way????

Regards

Kiran

Edited by: r.a.kiran on Feb 22, 2012 1:41 AM

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Then if E1CUCFG exsits and it has POSEX take 003 , then the "ListOfStructuredNote" should appear in that Item , that is creating lot of problem...might be its simple or something tricky

For scalability purposes, you will need a UDF for this e.g in E1CUCFG POSEX has two entries 002,003

you can try the mapping below:


 POSEX(E1EDP01) -> removeContext -> UDF -> SplitByValue:eachValue -> createIf -> ListOfStructuredNote
 POSEX(E1CUCFG) -> removeContext -> /

UDF Code is as follows

Execution Type: Context Type

Arguments: edpInp

cucInp


HashMap map = new HashMap();

for(int a=0;a<cucInp.length;a++){
	if(!map.containsKey(cucInp[a])){
		map.put(cucInp[a],"");
	}
}

for(int a=0;a<edpInp.length;a++){
	if(map.containsKey(edpInp[a])){
		result.addValue("true");
	}
	else
		result.addValue("false");
}

Hope this helps,

Mark

Former Member
0 Kudos

HI,

Try to use the Node Functions....You can achive it..

Regards,

Jude