on 12-11-2013 5:47 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 requirement is to create multiple target elements Notes,ID and Text
In TDLine we are getting conditions with the following format.Need to concatenate each t&c in one node of text
E1EDKT2
TDLine .. (1) some text for terms and conditions
E1EDKT2
TDLine continutation of (1) text for t&C
E1EDKT2
TDLIne continuation (1) text for T&C
E1EDKT2
TDLIne continuation (1) text for T&C
E1EDKT2
TDLIne (2) some text for terms and conditions
E1EDKT2
TDLIne some text for terms and conditions
E1EDKT2
TDLIne some text for terms and conditions
E1EDKT2
TDLIne (3) some text for terms and conditions
For each T&C We need to created separate Notes ,Id and Text in target elements
Expected Target
Notes
Id >ID1 >
Text >(1)Sometext for terms and conditions continuation(1) text for t&C Continuation of (1) text for T&C
Notes
Id >ID1 >
Text >(2)Sometext for terms and conditions continuation (2) text for t&C Continuation of (2) text for T&C
Notes
Id >ID1 >
Text >(3)Sometext for terms and conditions continuation (2) text for t&C Continuation of (2) text for T&C
I need your help please
Hi Mahesh
Please provide us the sample data for TDLINE so that we can provide u the necessary mapping.
From the existing data, its impossible to provide the solution.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mahesh
Do the mapping as below
write two udf. One for populating text and one for populating notes. Choose all values of context option in UDF. Also set the context of TDLINE to e1edkt1.
Populate Notes code :
for ( int i = 0; i < tdlines.length; i++)
{
for ( int j = 0; j < tdlines.length; j++)
{
String txt = "("+j+")";
if ( tdlines[i].indexOf(txt) != -1 )
result.addValue(tdid[0]);
}
}
Populate Text:
int count = tdlines.length;
ArrayList list = new ArrayList();
String text = "";
int cnt = 0;
int start = 0;
for ( int i = 0; i <count; i++)
{
for ( int j = 2; j < tdlines.length; j++)
{
String txt = "("+j+")";
if ( tdlines[i].indexOf(txt) != -1 )
{
for ( int k = start; k < i; k++)
{
text = text + tdlines[k];
}
start = i;
list.add(text);
list.add("CC_");
text = "";
}
}
}
for ( int m = start ; m < tdlines.length; m++)
{
text = text + tdlines[m];
}
list.add(text);
for(int i = 0;i < list.size();i++){
if(list.get(i).toString().equals("CC_"))
result.addContextChange();
else
result.addValue(list.get(i).toString());
}
Output:
Let me know if there are any issues.
Thank you vey much Indrajit. I appreciate your help. Only one issue is The first TC is combined with initial text as per attached screen shot. I changed the variable J= 0 or 1 and it is coming properly but then last tc is missing . Toal i have 6 + some intial text before (1). Total I am geting 6 elements not 7 .Attached expected screenshot but in that 6 th TC is not populating
Hi Mahesh
I have written the code based on the assumption that the first TDLINE will have the value of terms.Hence it is not working as expected. I have modified the code now. The new code will handle both the cases
1. First TDLINE has terms ( example (1) some text for terms and conditions )
2. First TDLINE does not have terms data
Code:
Populate Notes:
String adtext = tdlines[0];
boolean flag = false;
for ( int j = 0; j < tdlines.length; j++)
{
String val = "("+j+")";
if ( adtext.indexOf(val) != -1 )
flag = true;
}
if ( flag == false )
{
result.addValue(tdid[0]);
}
for ( int i = 0; i < tdlines.length; i++)
{
for ( int j = 0; j < tdlines.length; j++)
{
String txt = "("+j+")";
if ( tdlines[i].indexOf(txt) != -1 )
result.addValue(tdid[0]);
}
}
Populate Text:
int count = tdlines.length;
ArrayList list = new ArrayList();
String text = "";
int start = 0;
int firstcount = 0;
String adtext = tdlines[0];
boolean flag = false;
for ( int j = 0; j < tdlines.length; j++)
{
String val = "("+j+")";
if ( adtext.indexOf(val) != -1 )
flag = true;
}
if ( flag == false )
{
firstcount = 1;
}
else
{
firstcount = 2;
}
for ( int i = 0; i <count; i++)
{
for ( int j = firstcount; j < tdlines.length; j++)
{
String txt = "("+j+")";
if ( tdlines[i].indexOf(txt) != -1 )
{
for ( int k = start; k < i; k++)
{
text = text + tdlines[k];
}
start = i;
list.add(text);
list.add("CC_");
text = "";
}
}
}
for ( int m = start ; m < tdlines.length; m++)
{
text = text + tdlines[m];
}
list.add(text);
for(int i = 0;i < list.size();i++){
if(list.get(i).toString().equals("CC_"))
result.addContextChange();
else
result.addValue(list.get(i).toString());
}
This will give you the desired output.
Hi Indrajit.
I have a small request. It is working perfect and only the issue is the nos of terms and conditions like (1) ,(2) which are coming in the begining of TDlines .But sometimes there are nos (15) in the middle of text in the terms and conditions. Is there any we can modify it so that it looks only in the begining of tdline and not any where in TDLINE or any other thoughts
example
TDLINE (1)This is for testing This is for testing
TDLiNE (2) This is for testing of (5)scenario and testing of scenario(6).
TDLINE (3)This is for testing This is for testing
In the above case Notes splitting at (5) and (6) which is not correct.
Not sure whether it is possible or not
Thanks for your help
Currently we have 12 terms and condiitons . I was tying to hardcode no of terms and conditions.I To get the value of substring of tdline = (1) ,(2),(3) which is each terms and conditions .I need to contactenate all the values of (1),(2),in each different target text node.. I am trying with the following but it is not working.I am able to get the required Notes and IDs in the taget but the TDLine getting exception
can anyone help .please
String concatText="";
String TCCheckfield = "XXXXXXXXXXXXXXXXX" ;
for(int i=0;i<tdline.length;i++)
{
// concatText = concatText + "" + tdline[i] ;
for (int j= 0;j>=17;j++)
{
if (tdline[i].substring(0,2).equals(j))
trace.addInfo("inside tc condition" + "" + j );
{
concatText = concatText + " " + tdline[i] +"\n" ;
trace.addInfo("inside tdi other condition" + "" + tdline[i]);
result.addValue(concatText) ;
result.addContextChange();
}
}
// result.addValue(concatText) ;
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Mahesh,
Is there any identifier that will let you know that the text has ended for t&c? In your example, it may be possible to group the t&c if there is a number before it e.g (1).
Regards,
Mark
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.