on 04-09-2009 5:13 PM
Hi all,
My source text field can sends anything from 1- 80 characters, and I'm mapping to Idoc which can handle only 70 chars....I can't use sub-string node function here because it can send 1 character also.....and ArrayOutofbound error....
Any solution?
Thanks,
Sri
Yes you can use the Substring function. How??
Use iflese and length function in you mapping. See first you check the length of incoming field if it is greater than 70 than substring it and map to target otherwise map it without substring.
I hope it solves your problem..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
>
> Sarvesh,
>
> But the extra 10 character text which is coming in will be mapped to another duplicate node right....there this logic is not working....its giving:
>
> java.lang.StringIndexOutOfBoundsException
>
> Thanks,
> Srini
Srini,
My understanding is, you should create the duplicatge node only when the length of source field is greater than 70.
So first validate the duplicate segment's parant node so that it will be created only when length is greater than 70 and after that you do the mapping of your field with same logic. By this way you can ensure that it will always have some value to pass in Substring function so that it will not throw the error "StringIndexOutOfBond".
I hope your first node is being created without any problem.
Regards,
Sarvesh
>
> It's not working....I think I have to write UDF with exception handling for the sub- string......do you have any sample code..
>
> Thanks,
> Srini
Srini,
I don't know why it is not working, coz as per my understanding it should work with out any problems.
See, you do not have to use Substring function anymore for duplicate node. You only need to check if the length of incoming source is greater than 70 then only create the duplicate segment & then simply map the source field to target field. So in this case if incoming source field is having any value starting from 71 to 80 it will be mapped to target field.
I don't think you require any UDF for this.
Regards,
Sarvesh
Sarvesh,
See, you do not have to use Substring function anymore for duplicate node. You only need to check if the length of incoming source is greater than 70 then only create the duplicate segment & then simply map the source field to target field. So in this case if incoming source field is having any value starting from 71 to 80 it will be mapped to target field.
I'm not using any sub-string on the second segment, but its still putting the whole thing in the second field..... I used ifwithoutelse
Thanks,
Srini
Srini,
Write a small UDF to check whether the character length is less than 70, if so then pass it, if not then just get the first 70 characters. its a simple UDF.
Regards,
Pavan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
81 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.