6 Replies Latest reply: Oct 27, 2016 5:16 PM by Marco Wedel RSS

    Add hyphen to a string value based on the mapping file

    Chaithra R

      Hi,

       

      I want to add hyphen to a string value and the position of the hyphen has to considered from the mapping file.

       

      From the input file,Lookup the first 3 char of the SKU against the mapping file.

      Based on the length mentioned for the corresponding entry in mapping file, add "-" at xth position from the end, where x is the length defined in the mapping file.If it doesn't find a match in the mapping file, input string value has to retained as is.

      Below is the example for reference.

       

      Input file:

      SKU

      CPC12345

      CPDE456
      12345

       

      Mapping File:

      SKU CategoryLength
      CPC3
      CPD4
      ABG8

       

      Expected output:

      SKU
      CPC123-45
      CPDE-456
      12345

       

      Thanks in advance.