2 Replies Latest reply: Jun 28, 2012 9:11 AM by Wilfredo Gonzalez RSS

    I'm getting "syntax error" with this code.  What could be wrong?

    Wilfredo Gonzalez

      I'm getting "syntax error" with this code.  What could be wrong?  It is related to the If..then.elseif block, since when I comment it the script works fine.

       

      // Transformation of Attendance Transactions in HoursDetail

      AttTrans:

      LOAD DTPunchDate,
          
      sType as TransType,
          
      dblHours as AttHours,
          
      id as EmpID,
          
      sCompanyName as BusinessUnit,
          
      left(sDeptName,index(sDeptName,'-')-1) as DeptNo,
          
      Mid(sDeptName,Index(sDeptName,'-')+1) as DeptName,

           sJobTitleName as WorkCenter,
          
      sEmployeeTypeName as PayGroup

      FROM
      C:\QlikViewDocuments\Extracts\TimeAide6\viewHoursDetail.qvd
      (
      qvd)
      Where sEmployeeTypeName <> 'SEE';

      /* ---- Joins Definition fields from TransDef ---- */

      LET AttCategCode = '';

      Left Join (AttTrans)

      LOAD TransType,

      //   nAttendaceCategory as AttCategory,

           if (nIsAbsent = 1,'Y','N') as AbsenceYN,
           
      /* Takes out the "_" from the Parent transaction */
           
      if (left(sParentCode,1)='_',Mid(sParentCode,Index(sParentCode,'_')+1),
           
      sParentCode) as ParentTrans,
           
      nAttendanceRevision as AttendanceRevision,
           
      nTardinessRevision as TardinessRevision,

           
      if nAttendaceCategory = 0 then
             
      $(AttCategCode) = 'Payable'
            ELSEIF nAttendaceCategory = 1 then
             
      $(AttCategCode) = 'Controllable
            ELSEIF nAttendaceCategory = 2 then
              $(AttCategCode) =  'NonControllable'
            ELSE
              $(AttCategCode) = 'Null'
            ENDIF
            $(AttCategCode) as AttCategory
      Resident TransDef;
      DROP Table TransDef;

      //STORE AttTrans into $(vRoot)Transformations\TimeAide6\AttTrans.qvd;
      //DROP Table AttTrans;