1 Reply Latest reply: Oct 10, 2017 9:10 AM by Marcus Sommer RSS

    Connecting 2 tables using different fields based on condition

    Radu Panciuc

      Hi Guys,

       

      I have 2 different tables in which I have information about 3 Plants. Unfortunately, each Plant uses a different logic for the connection between the 2 tables like below (the names are the field names):

       

         

      PlantTable 1Table 2
      AReference NoTracking ID
      BSub Ref NoTracking ID
      CSub Ref NoLoading ID

       

      What I tried to do is to use 'if' statements in each load script to rename the fields to a common field based on the Plant condition. Something like below.

      Table 1:

      If(Plant='A', "Reference No" = TableKey,

      If(Plant='B' or Plant='C', "Sub ref no" = TableKey))

       

      Table 2:

      If(Plant='A' or Plant='B', "Tracking ID" = TableKey,

      If(Plant='C', "Loading ID" = TableKey))

       

      I am not sure this is the right logic to get these things done. In addition, when trying to load the scripts, Qlik Sense gives the error that Field 'TableKey' not found.

       

      Any help is appreciated! Thanks!