1 Reply Latest reply: Nov 8, 2018 9:06 AM by Dilip Ranjith RSS

    Compare two tables, if not then colour red

    Miroslav Kopecký

      Hi, I have this task...

      I have 2 tables: Word and words_frequency_1.Word as you can see in picture.
      I need to compare words from table Word with words in table words_frequency_1.Word and those words which are not in words_frequency_1.Word should be shaded in table Words with red colour.
      I dont have enough practice with coding in Qlik Sense so I am writing for help.

      Thanks in advance.
      Untitled.png

        • Re: Compare two tables, if not then colour red
          Dilip Ranjith

          See below an approach

          Mark the matched values in load script with a flag and use background color expression e.g. if(Matched,green(),red()). result and scrip below

          Capture.PNG

          in your load script

          Word_1:

          load * inline [

          Word

          ab

          bb

          cc

          dd

          aa

          mm

          ];

          Word_2:

          load * inline [

          Word_2

          ab

          bs

          cs

          ds

          aa

          mm

          ];

          //Load only matched values into temp table

          Word_comp_temp:

          left keep(Word_1)

          load Word_2 as Word

          Resident Word_2;

          /Mark matched values in table 2

          Left Join(Word_2)

          load Word as Word_2, 1 as Matched

          resident Word_comp_temp;

          //drop temp table

          drop table Word_comp_temp;