on 11-28-2013 3:51 AM
Here is the source and target structure
udf for Multiple target nodes
source Target
e1edkt1 0..99 Notes 0.1000
TDID 0..1 ID 0.1
E1EDKT2 0..999999 Text 0..1
TDLINE 0..1
my requiremtn is to create multiple target elements Notes,ID and Text
For each EDKT2>TDLINE> of 30 lines TDLINES, in target has to create separate Notes and ID , Text
I need to concatenate all the 30 lines TDLINE to Text and next 30 lines to next node and corresponding TDID to corresponding
TDID of Notes
I need help udf for edkt1>Notes,TDID>ID,TDLINE>Notes
Thanks for your help
Hi Mahesh
Please do your mapping as below
Notes will be created based on the count of TDLINE. Below is the UDF code. Use all of context option
int count = Integer.parseInt(segcount[0]);
for (int i = 0; i < count; i = i+30)
{
result.addValue("");
}
field mapping
Since the same TDID will be used in both the notes, we have to use the function use one as many
Next we need to write one more UDF for populating text
code :
int count = tdline.length;
String text = "";
int cnt = 0;
int start = 0;
for ( int i = start; i <count; i++)
{
cnt = cnt + 1;
text = text + tdline[i];
if ( cnt % 30 == 0)
{
result.addValue(text);
start = start+ 30;
}
}
String data = "";
for ( int i = start; i < count ; i++)
{
data = data + tdline[i];
}
result.addValue(data);
field mapping
Output:
I have used 34 TDLINE as input
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Indrajit
Thank you very much your help. I have two questions.
1) E1EDKT1
ST
E1EDKT2
TDLIINE
E1EDKT2
TDLIINE
E1EDKT2
TDLIINE
....
.... REPEATING 135 This one created Notes and ID 5 times which is expected.
E1EDKT1
FO1
E1EDKT2
TDLIINE
E1EDKT2
TDLIINE
E1EDKT2
TDLIINE this one only 10 TDLINEs but it has to create notes for this one also.
This second part Notes and ID is not created in target
Dont we need to map Notes to EDKT1 so that it will create all instances of Notes .
2) In populate text code , it is concatanting 30 lines but the seconde node also again adding first 30 lines of text + another 30 lines. in the same way 3rd notes text also ..The second node sjhould start from 31 lines and third one should start from 61 line.I set context also as you suggested
Thaniks for your time and I appreciate your help
Thanks for your help
Hi Mahesh
I have tested with two E1EDKT1 segment. First one is having 142 TDLINE and the next one is having 10 TDLINE.
I can see that 6 NOTES have been created. 5 for first case and 1 for second case.
So make sure you have done the following
You have choose the execution of UDF is All value of Context
set the context of TDLINE to e1edkt1.
for Text node, yes there was a small mistake in the code. Here is the correct code
int count = tdline.length;
String text = "";
int cnt = 0;
int start = 0;
for ( int i = start; i <count; i++)
{
cnt = cnt + 1;
text = text + tdline[i];
if ( cnt % 30 == 0)
{
result.addValue(text);
start = start+ 30;
text = "";
}
}
String data = "";
for ( int i = start; i < count ; i++)
{
data = data + tdline[i];
}
result.addValue(data);
Please test and let me know if there are any issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How you map TDID to target so you define that TDLINE are corespond to particular TDID
so your strucutre look like
root
TDID 0..1
Notes 0..1000
ID 0..1
Text 0..1
Plz confirm..
Regrds
Gagan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gagan
Source and Target structure attached.
I was able to generate the multiple nodes by using the code by Indrajit.
But I am not getting the if more than one EDKT1 segments in the source ,I am always getting only to the target with multiple nodes for that EDKT1 .
Not getting for second EDKT1 nodes in the Target
Thanks for everyone for the help
EDKT1 Notes
TDID =ST ST
EDKT2 Test1Test2Test3
Test1
EDKT2
Test2
EDKT2
Test3
EDKT1 Not getting created Note for this
F01
EDKT2
Test2
EDKT2
Test3
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.