Skip to Content
author's profile photo Former Member
Former Member

How to handle multiple source fields in message mapping

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Aug 07, 2009 at 02:23 PM

    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,

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 07, 2009 at 01:46 PM

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 07, 2009 at 03:35 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.