Skip to Content
avatar image
Former Member

Split by value

Hi Group,

I have one requirement File to IDOC , I need to create IDOC based on the Custromer name and address , if customer name change and Street field is populated then I need to one IDOC , in the below example I need to create 4 Idocs , one for John , 2 for Mark and 1 for Adam , can you advice how I do mapping.

Customer Name Street District John Milton Street Glos John John John Mark 31 Jameson Street Northfield Mark Mark 32 James Street Northfield Adam 99 Johnson Street Southfield Adam Adam
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

6 Answers

  • Best Answer
    Sep 17, 2014 at 10:01 AM

    Hi Rajiv,

    are you expecting this kind of output ?

    Thanks,

    Binod


    output.JPG (68.7 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • You may use this example to understand how we can make use of graphical mapping to achieve this. You may improve this as well if possible.

      Below is the input and output structure and also the mapping for Records and subrecord. Rest of the fields are having one to one mapping.

      Note: change all the properties of (if then node) to false

      Below code is to be used for replacyEmpty UDF

      public void replaceEmpty(String[] a,String[] b,ResultList result,Container container){

         //write your code here

      String lastValue = null;

      for (int i=0; i<a.length;i++)

      {

      if (!a[i].equalsIgnoreCase(b[0]))

      {

      1. result.addValue(a[i]);

      lastValue = a[i];

      }

      else

      {

      1. result.addValue(lastValue);

      }

      }

      }

      3.jpg (78.4 kB)
  • avatar image
    Former Member
    Sep 16, 2014 at 02:08 PM

    Dear Rajiv,

    please do like below might be help you customer name = Street then you map to your Idoc .from below mapping you remove Copy value.

    Regrds,

    Rajendar K


    pastedImage_0.png (15.4 kB)
    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Rajendran,

      I didn't get your solution , my requirement is when customer Name in next row is same and Street is Null then needs to extend IDOC , if customer Name is same and Street field is populated (not Null) then it needs to create new IDOC.

  • Sep 16, 2014 at 03:17 PM

    Hi Rajiv

    Try something like this

    Regards


    Captura.JPG (25.1 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Sep 16, 2014 at 03:07 PM

    Hi,

    Please use below mapping

    In place of Header use Name and in place of FLag use adress... you will get the desired output...

    Please let me know still face any issue...

    Thanks,

    Sreenivas


    test.jpeg (16.7 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Sep 17, 2014 at 09:05 AM

    Hi Rajiv,

    Can you please share the sample file ?

    Thanks,

    Binod

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 17, 2014 at 10:06 AM

    Hi Rajiv,

    It looks like you need to create Idocs only when the Street is filled. So you can directly map based on the Street field without having dependency on the customer name.

    Street -> remove empty values-> Target Idoc

    Regards,

    Anand Patil

    Add comment
    10|10000 characters needed characters exceeded