on 08-07-2009 2:37 PM
Hi,
My source message has the following structure for my source field:
<ParentSegment>
<DAT01></DAT01>
<DAT02></DAT02>
<DAT03></DAT03>
...
<DAT24></DAT24>
<DAT25></DAT25>
</ParentSegment>
I need to check each of the DAT fields starting from field 1 to field 25 for the first field that contains a value and then map that field value to a single target field. I know this can be done using the available functions in the graphical mapping to check each field one at a time and map the field that contains a value. However, I wanted to know if there is a better way of doing it such as iterating over the total number of fields and accessing each of the field dynamically to determine which contains a value? If this is possible, can you please show me how this can be done?
Thanks in advance for any help.
Regards,
Elbert
Hi Elbert,
This can be done using both graphical mapping and udf... instead of checking each of the node for existence you can try using this mapping:
<DAT01> --> mapWithDefault: --> concat: --> concat: --> concat: --> trim --> UDF --> copyValue[0] --> Target Field
<DAT02> --> mapWithDefault: --> /
<DAT03> --> mapWithDefault: -----------------> /
.
.
<DAT25> --> mapWithDefault: -------------------------------> /
please take note that there is a space for mapWithDefault and concat, This ensures that succeeding fields with values does not get concatted into a single word. The UDF stated here is a splitter, after the trim,
hope this helps,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elbert,
>starting from field 1 to field 25 for the first field that contains a value and then map that field value to a single target field
Can you give an example. Your questions is not complete. From field1 to field25 if you say you are looking for a value HI and lets say you have that value in field12 and field16 then do you want to take it from field12 and ignore the other one? or are we trying to see the first character value of the field?
Anyways in either cases you can go with a grapical mapping. You can also come up with a User defined funciton, but here also you have to check individual fields. If you can tell what you want exactly then somebody can help you out with UDF or graphcial mapping?
Regards,
---Satish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Elbert,
You can acheive this by using the combination of both (Available functions and UDF) writing Java code iwich will check the value nside the UDF (of type Context) and map this to the target field.
<ParentSegment> -
> Removecontext -
>UDF(to chek the values) -
> target field.
Thanks,
Ram..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.