on 07-07-2009 7:27 PM
Hello,
i have a requirement where, my source is sending some long description and i need to map it to different fileds...
so say my source sends some thing like 260 characters...i need the same to be split as 140 in target field A, 40 in target field B, 40 in c and 40 in D.
but this is not my concern, this is taken care of..
Now, the question is...if say from 137th character the word "telephone" starts...i do not want my target field to get truncated with value upto 140 character or ....tele. i want XI to apply some logic and take it till 144th character, i.e end of word telephone and then B would have from 145th character to 180th character and same way for other fields...
Is the above possible, and if yes, then how?
Thanks,
Vishal
Hey
Can't you do this via Multimapping and writing a UDF whcih checks for string at position 140,180,220,260.
if at any of these places you find a non-blank,then read the next character until you find blank,then pass this to receiver side.
prima facia,i dont see any issue in doing this,you just need to write a UDF which will handle this.
Thanks
Aamir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Aamir.
but in this case, assuming the word "computer" comes in and gets over at 144th character. Now how would my field B get tok now that it has to write in from 145th character?
Do i need to hold the value at which the space comes after 140 and write in field B from that value to 180.
makes sense?
thanks,
Vishal
>>Do i need to hold the value at which the space comes after 140 and write in field B from that value to 180
Yeah,pretty much
Your logic would be something like this
//Take your input in the string inputString
int i,j,k,l;
String temp1,temp2,temp3,temp4;
String output1,output2,output3,output4;
for (i=140;i<inputString.length();i++)
{
temp1=inputString.charAt(i);
if temp1=" "
{
output1=inputString.substring(0,i);
break;
}
else
{
temp1=inputString.charAt(i+1);
}
}
//read second string
for (j=i;j<inputString.length();j++)
{
.....
.....
....
}
//read third string
for (k=j;k<inputString.length();k++)
{
........
.....
.....
}
//read fourth string
for (l=k;l<inputString.length();l++)
{
....
...
..
}
The above code wont be syntactically correct since i just scribbled it but the logic would be similar.
Thanks
Aamir
Vishal,
Technically we can go ahead with what aamir says. But logically there would be more breaking points with that approach. Since it is text and the end user might not put a space. Never know. or you have to use if else and then combining udfs might work. Lots of testing needs to be done. So you may need to rethink the design. Always the end user does wrong
Thats my 2 cents
Regards,
---Satish
It is not possible Vishal.
---Satish
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 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.