3 Replies Latest reply: Aug 24, 2009 9:15 PM by John Witherspoon RSS

    Dynamic Field Names

    BeBe79

      Hi...

      I'm trying to load multiple Fields into one Flied:

      For example:

      LOAD

      Icd+iterno() AS Icd

      FROM .... WHILE iterno()<=30;


      In this File are 30 Fields from "Icd1" to Icd30.

      Is there any clue to solve that problem without using 30 JOIN LOAD of that Table?

       

      Thanks!!!

       

        • Dynamic Field Names

          Hi,

          If I understand the problem correctly, you want to take data for all 30 columns from source file and store into 1 column in qlikview. Below is a sample code for implementing this:



          Tab1:
          LOAD Icd1 AS Icd
          FROM ....;

          FOR a = 2 TO 30
          CONCATENATE(Tab1)
          LOAD Icd$(a) AS Icd
          FROM ...;
          NEXT



          Hope this works..

           

          Thanks

          Amit

          • Dynamic Field Names
            Martijn ter Schegget

            Hello Olaf,

            Not sure if I understand the question; could you explain what your input format is (I guess it's rows with columns ICD1 - ICD30) and what output format you want (rows with [ICD1, <value>], [ICD2, <value>], etc.? or perhaps all ICD-values concatenated as '<value>, <value>, <value>, ...' in one column?)

            With regards,

            Martijn ter Schegget

              • Dynamic Field Names
                John Witherspoon

                OK, so you have a table like this?

                Icd1 Icd2 Icd3... Icd30
                5 10 20 ... 50
                3 2 1 ... 14

                And you want to end up with a table like this?

                Icd
                5
                10
                20
                ...
                50
                3
                2
                1
                ...
                14

                If so, then I believe this would work:

                CROSSTABLE (Sequence,Icd,0)
                LOAD Icd1, Icd2, Icd3... Icd30
                FROM your data source;
                DROP FIELD Sequence;