3 Replies Latest reply: Jul 29, 2009 8:10 PM by Héctor Muñoz RSS
      • SQL "Like" in QlikView

        Hi, you can use the function wildmatch(), with thw wildcards '*' for more than 1 character, or the '?' for one, this is an example script and table

        t1:LOAD F1, if(wildmatch(F1,'sup*'),'True','False') as like_1, if(wildmatch(F1,'*sup'),'True','False') as like_2, if(wildmatch(F1,'*sup*'),'True','False') as like_3, if(wildmatch(F1,'?at?up'),'True','False') as like_4
        INLINE [ F1 Sup sup superi Catsup Catzup];<table><tbody><tr> <th>F1 </th><th>like_1 </th><th>like_2 </th><th>like_3 </th><th>like_4</th></tr><tr> <td>Catsup </td><td>False </td><td>True </td><td>True </td><td>True</td></tr><tr> <td>Catzup </td><td>False </td><td>False </td><td>False </td><td>True</td></tr><tr> <td>Sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>superi </td><td>True </td><td>False </td><td>True </td><td>False</td></tr></tbody></table>

        I hope this can help u

        Regards

         

        • Rounded Border

          Hi, you can use the function wildmatch(), with thw wildcards '*' for more than 1 character, or the '?' for one, this is an example script and table

          t1:LOAD F1, if(wildmatch(F1,'sup*'),'True','False') as like_1, if(wildmatch(F1,'*sup'),'True','False') as like_2, if(wildmatch(F1,'*sup*'),'True','False') as like_3, if(wildmatch(F1,'?at?up'),'True','False') as like_4
          INLINE [ F1 Sup sup superi Catsup Catzup];<table><tbody><tr> <th>F1 </th><th>like_1 </th><th>like_2 </th><th>like_3 </th><th>like_4</th></tr><tr> <td>Catsup </td><td>False </td><td>True </td><td>True </td><td>True</td></tr><tr> <td>Catzup </td><td>False </td><td>False </td><td>False </td><td>True</td></tr><tr> <td>Sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>superi </td><td>True </td><td>False </td><td>True </td><td>False</td></tr></tbody></table>

          I hope this can help u

          Regards

           

          • Rounded Border

            Hi, you can use the function wildmatch(), with thw wildcards '*' for more than 1 character, or the '?' for one, this is an example script and table

            t1:
            LOAD
            F1,
            if(wildmatch(F1,'sup*'),'True','False') as like_1,
            if(wildmatch(F1,'*sup'),'True','False') as like_2,
            if(wildmatch(F1,'*sup*'),'True','False') as like_3,
            if(wildmatch(F1,'?at?up'),'True','False') as like_4
            INLINE [
            F1
            Sup
            sup
            superi
            Catsup
            Catzup
            ];
            <table><tbody><tr> <th>F1 </th><th>like_1 </th><th>like_2 </th><th>like_3 </th><th>like_4</th></tr><tr> <td>Catsup </td><td>False </td><td>True </td><td>True </td><td>True</td></tr><tr> <td>Catzup </td><td>False </td><td>False </td><td>False </td><td>True</td></tr><tr> <td>Sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>sup </td><td>True </td><td>True </td><td>True </td><td>False</td></tr><tr> <td>superi </td><td>True </td><td>False </td><td>True </td><td>False</td></tr></tbody></table>

            I hope this can help u

            Regards