4 Replies Latest reply: Jun 15, 2017 5:52 AM by Volha Valiuk RSS

    Case insensitive load

    Volha Valiuk

      Hi everybody,

       

      In script I am reading data from an existing qvd file. The script can not see filed 'field1' if in qvd it is 'FIELD1'. Some of the fields are in upper case, others are in lower. How can I make it case insensitive? I tried FORCE UPPER CASE, but it didn't help.

        • Re: Case insensitive load
          Andrey Khoronenko

          Hi Volha,

           

          It looks like an adventure, but it can be as variant

           

          //set the mode of ignoring errors

          set ErrorMode=0;

           

          LOAD

          [Variant1 Field Name]

          ...

          FROM

          ...

           

          If ScriptError>0  //did not guess the name of the field

          LOAD

          [Variant2 Field Name]

          ...

          FROM

          ...

          End If

          ........

           

          If ScriptError>0  //did not guess the name of the field

          LOAD

          [VariantN Field Name]

          ...

          FROM

          ...

          End If

           

          //set mode errors default

          set ErrorMode=1;

           

          Regards,

          Andrey

          • Re: Case insensitive load
            swathi k

            Hi,

             

            Use Upper() in script and for column names in you can use alise name

             

            try like'

             

            Upper(fieldName) as FIELDNAME

             

            Regards,

            Swathi

            • Re: Case insensitive load
              Peter Rieper

              So you read different qvds with changing fieldnames???

               

              You may use a script like:

               

              MyTable: LOAD * FROM .....qvd;

               

              FOR i = 1 TO NOOFFIELDS('MyTable')

              LET sOldField = FIELDNAME(i, 'MyTable');

              LET sNewField = UPPER(sOldField);

               

              RENAME FIELD $(sOldField) TO $(sNewField);

               

              So you have all fields in Upper-case and continue with uniform names.

               

              Peter

              • Re: Case insensitive load
                Volha Valiuk

                Hi All,

                Actually it helped to avoid an issue with case insensitivity when I install Hortonworks driver instead of Cloudera.