3 Replies Latest reply: Oct 8, 2013 4:15 PM by 996794 RSS

    Generate header option as variable

    996794

      Hi,

      I have a requirement where I want to use the same interface to write/append a file multiple times based on some conditions.I want to be able to control the Header column generation based on a variable value.

      The Generate Header option in the IKM SQL to File append is a checkbox and it can only be set to True of False. So if I set it to true, it generates header each time the interface is run. Is there a solution for it?

       

      Thanks,

      Puneet

        • 1. Re: Generate header option as variable
          SH

          Hi,

           

          I imagine that you customize the KM so it takes a True / False value for the option instead of this being set by a checkbox, or create another KM option and use that to drive the header creation. Create a copy of the KM before customization and investigate which is the most appropriate approach.

          • 2. Re: Generate header option as variable
            996794

            Hi SH,

            The generate header step is using file technology and following code , with GENERATE_HEADER option checked as yes.

             

            create header    <%=odiRef.getTargetColList("(", "[COL_NAME]", ",\n\t", ")")%>

             

            Can you tell me what changes I need to make? I can Make the GENERATE_HEADER option as text (instead of checkbox), but how to use it to drive header creation?

             

            Thanks,

            Puneet

            • 3. Re: Generate header option as variable
              996794

              I changed the GENERATE_HEADER option to datatype text and it works partially:

              Here is the code for step:

               

              <%if(odiRef.getOption("GEN_HEADER").equals("Y")) {%>

              create header     <%=odiRef.getTargetColList("(", "[COL_NAME]", ",\n\t", ")")%>

               

              <% } %>

               

              It works perfectly when the value is Y. but fails when the option is set to N, with below error:

               

              ODI-1228: Task TEST (Integration) fails on the target FILE connection EBS_Export.

              Caused By: java.sql.SQLException: ODI-40480: Malformed INSERT statement.

               

              The code generated in case of option N is:

              /*$$SNPS_START_KEYSNP$CRDWG_TABLESNP$CRTABLE_NAME=GL_EXTRACT_DETAILSNP$CRLOAD_FILE=C:\TEST\/#GL_EXTRACT.P_FILE_NAMESNP$CRFILE_FORMAT=DSNP$CRFILE_SEP_FIELD=0x007cSNP$CRFILE_SEP_LINE=0x000D0x000ASNP$CRFILE_FIRST_ROW=1SNP$CRFILE_ENC_FIELD=SNP$CRFILE_DEC_SEP=SNP$CRSNP$CRDWG_COLSNP$CRCOL_NAME=Line_ColsSNP$CRTYPE_NAME=STRINGSNP$CRORDER=1SNP$CRLENGTH=50SNP$CRPRECISION=50SNP$CRACTION_ON_ERROR=0SNP$CRSNSNP$CRACTION_ON_ERROR=0SNP$CR$$SNPS_END_KEY*/

               

              I cant find a way to comment this section. So workaround is to ignore errors on step.

              Any better ideas are welcome!!

               

              Thanks,

              Puneet