5 Replies Latest reply: Jun 9, 2016 2:05 AM by Damien Aiello RSS

    Data model obviously wrong

    Damien Aiello

      Hi,

       

      First of all, I'm new to QlikView, so please excuse my ignorance. Also I'm french, so please excuse my english

      I'm trying to load some datas to build some tables. Right now, I'm doing like this (and it's not working, obviously):

       

      [TIRS]:

      LOAD

      [NUMERO_TIR],

      [NUMERO_REFERENCE]

        FROM [lib://Indus/2.0/tirs.csv]

      (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

       

      [METRIQUES]:

      LOAD

      [NUMERO_TIR],

      [METRIQUE],

      [VALEUR_METRIQUE]

        FROM [lib://Indus/2.0/metriques.csv]

      (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

       

      NUMERO_TIR is a unique number, and NUMERO_REFERENCE is a number equal to a NUMERO_TIR. It can only be a NUMERO_TIR, not another value.

      I would like to import those data and display the following in a table :

      METRIQUE | VALEUR_METRIQUE | VALEUR_REFERENCE

       

      It's easy to get METRIQUE and VALEUR_METRIQUE for a NUMERO_TIR, But I can reach to VALEUR_REFERENCE, which is a VALEUR_METRIQUE for another NUMERO_TIR, referenced by NUMERO_REFERENCE.

       

      I'm not sure if I'm clear, let me know if I'm not.

       

      I don't have any unique key in METRIQUES, but I don't think it's the problem. I can't think of another model, can someone give me some advices ?

       

       

      Damien

        • Re: Data model obviously wrong
          Gysbert Wassenaar

          Try this:

           

          [TIRS]:

          LOAD

          [NUMERO_TIR],

          [NUMERO_REFERENCE]

            FROM [lib://Indus/2.0/tirs.csv]

          (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

           

          [METRIQUES]:

          LOAD

          [NUMERO_TIR],

          [METRIQUE],

          [VALEUR_METRIQUE]

            FROM [lib://Indus/2.0/metriques.csv]

          (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

           

          [METRIQUES_REFERENCE]:

          LOAD

          [NUMERO_TIR] AS [NUMERO_REFERENCE],

          [VALEUR_METRIQUE] AS VALEUR_REFERENCE

            FROM [lib://Indus/2.0/metriques.csv]

          (txt, codepage is 1252, embedded labels, delimiter is ';', msq);

            • Re: Data model obviously wrong
              Damien Aiello

              By reading your response, I think I may have forgotten an important detail : I have several METRIQUE for a NUMERO_TIR.

              Maybe I'll be more clear with example tables :

               

              Table "TIRS"

              NUMERO_TIRNUMERO_REFERENCE

              1

              2
              31
              41
              52
              61
              72
              85
              96
              105

               

              Table "METRIQUES"

              NUMERO_TIRMETRIQUEVALEUR_METRIQUE
              1Metric_1Value_1
              1Metric_2Value_2
              1Metric_3Value_3
              1Metric_4Value_4
              2Metric_1Value_5
              2Metric_5Value_6
              3Metric_1Value_7
              3Metric_2Value_8
              3Metric_3Value_9
              3Metric_4Value_10

               

              And eventually, the result I'd like, by selecting a NUMERO_TIR (NUMERO_TIR = 3 in this example) :

              METRIQUEVALEUR_METRIQUEVALEUR_REFERENCE
              Metric_1Value_7Value_1
              Metric_2Value_8Value_2
              Metric_3Value_9Value_3
              Metric_4Value_10Value_4