Skip to Content
avatar image
Former Member

remove of quotes"' in the sender file adapter -- file content conversion

HI Guys,

MY source file is comma seprated file (,) in the file i had quotes" " for the data like

"5000543","0.00","03/04/2009",

is there any way i can remove the quotes in file content conversion

Please help me on this

Regards

Srinivas

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Aug 06, 2009 at 10:54 PM

    Hi,

    FCC does not support that functionality.

    Options:

    1. Develop a module to delete the quotes.

    2. Put a java mapping inside your message mapping

    3. Handle it in your message mapping

    Regards

    Ivan

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Srinivas,

      Develop a UDF:

      public string removeQuotes(String a){
      
      if(a.length()>1){
      return(a.substring(1,a.length()-1))
      }else{
      return a;
      }
      
      }
      

      Then before any logic map this UDF with your source fields:

      sourcefield1->removeQuotes->[your logic]->targetfield

      Regards

      Ivan

  • avatar image
    Former Member
    Aug 07, 2009 at 04:14 AM

    Hi

    you can write UDF like bellow or use an function Standar Text ---> Replace

    public String replace(String source,char oldChar,String newString){
    
    String toReturn="";
    int index=source.indexOf(oldChar);
         if (index!=-1){
               if (index!=0)
                  toReturn+=source.substring(0,index-1);
                  toReturn+=newString;
                  toReturn+=source.substring(index+1,source.length());
         }
    return toReturn;
    } 
    

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 07, 2009 at 09:21 PM

    Srinivas,

    This should not be a big deal, because your fields are separated by a comma. So you need to keep in mind like you are doing the content conversion for a csv file.

    See this blogs for some information:

    /people/venkat.donela/blog/2005/03/02/introduction-to-simplefile-xi-filescenario-and-complete-walk-through-for-starterspart1

    /people/venkat.donela/blog/2005/03/03/introduction-to-simple-file-xi-filescenario-and-complete-walk-through-for-starterspart2

    In the second blog 1345 there are parameters for content conversion. So similarly mention your conversion parameters in your sender communication channel. So after converting to xml your input fields have values like:

    field1: "5000543"

    field2: "0.00"

    field3: "03/04/2009"

    So all your field values has with "". Now you can use either standard replace funciton or a udf as given above and then it will remove the quotes and then you can map according to your requirements. If you think sometimes you can get quotes and sometime not in the file then you can use function like startswith or endswith along with exists and can map accordingly.

    Regards,

    ---Satish

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Aug 21, 2009 at 06:26 PM

    Thanks for your help

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Srinivas,

      I know you have closed this thread, but would like to point out that there is no need to use a UDF for this.

      In your Sender File FCC, use these -

      xml.enclosureSign = "

      xml.enclosureSignEsc = " "

      Regards,

      Neetesh