1 Reply Latest reply: Mar 27, 2017 5:11 PM by Vishwarath Nagaraju RSS

    Convert SQL Query to Qlikview Script (No SQL access)

    Faye Nemer

      Hi,

       

      I don't have SQL access, but have a former employee's SQL query that I'd like to convert into QlikView script. I am including a segment of the script below:

       

      ,[PrinDxCode]

      ,[PrinDxDesc]

      ,CASE WHEN [PrinDxDesc] LIKE '%Metastatic%' THEN 'Metastatic'

             WHEN [PrinDxDesc] LIKE '%SEC%' THEN 'Metastatic'

             WHEN [PrinDxDesc] IS NULL THEN 'NULL'

             ELSE 'Primary' END AS 'Metastatic'

      ,CASE WHEN [PrinDxCode] LIKE '140%' THEN 'Lip'

             WHEN [PrinDxCode] LIKE '141%' THEN 'Tongue'

       

      ,[SecDx1Code]

      ,CASE WHEN [SecDx1Code] LIKE '140%' THEN 'Lip'

       

             WHEN [SecDx1Code] BETWEEN '1642%' AND '1649%' THEN 'Mediastinum'

      ELSE NULL END AS 'Sec1Category' ELSE NULL END AS 'Principle'

        • Re: Convert SQL Query to Qlikview Script (No SQL access)
          Vishwarath Nagaraju

          May be try this? If not can you share some sample data with expected output?

           

          IF(Wildmatch([PrinDxDesc], '*Metastatic*', '*SEC*') >=1, 'Metastatic', IF(Len(Trim([PrinDxDesc])) = 0, 'Null', 'Primary')) AS Metastatic,

          IF(WildMatch([PrinDxCode], '140*') >= 1, 'Lip', IF(WildMatch([PrinDxCode], '141*') >= 1, 'Tongue'))                        AS PrinDxCode,

          [SecDx1Code],

          IF(WildMatch([SecDx1Code], '140*') >=1, 'Lip', IF([SecDx1Code] >= (1642*10) AND [SecDx1Code] <= (1649*10), 'Mediastinum', Null)) AS Sec1Category