cancel
Showing results for 
Search instead for 
Did you mean: 

Characters sizing requirement from source to target

Former Member
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

>>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

Former Member
0 Kudos

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

Answers (1)

Answers (1)

Former Member
0 Kudos

It is not possible Vishal.

---Satish