6 Replies Latest reply: Sep 6, 2014 8:58 AM by Israr Khan RSS

    Script input of two datasets with the same field names

      Hi all,

       

      I'm trying to input two datasets with the same field names into a qvw file. The field names of them are the same but some of the data are different. I need to input both of them to do some expression calculations to create charts but I failed to do so. Could anyone give any suggestions on how to achieve this, please?

       

      Many thanks,

       

      Grace

        • Re: Script input of two datasets with the same field names
          ajay ajay

          Hi,

           

          select * from qvd1;

           

          concatenate

           

          select * from qvd2;

           

          The qvd2 data of the fields will concatenate with the fields data of qvd1.

           

          Thanks,

          Ajay

          • Re: Script input of two datasets with the same field names
            Israr Khan

            You can concatenate both data sources in to one qvd, and than you can do the calculations simply...

            and you can differentiate them, that which value coming from which data source, by loading like below...

             

            load 'Source1' as Source, *

            from Source1;

            where condition ...

             

            load 'Source2' as Source, *

            from Source2;

            where condition ...

             

            you dont nee to use concateneate keyword, because you said your fields name are same, it will be concatenated automatically, and you can use  the source field to know ,which value is coming from which source,....

             

             

            Hope it helps...

            • Re: Script input of two datasets with the same field names
              Marco Wedel

              please specifiy your requirements with some sample data / table structure.

               

              If you have identical fieldnames containing different data, then concatenation might not make any sense. Instead you could rename the fields using the "as" statement during load or with "rename field(s)" after loading the first table.

               

              Dependent of your data and requirements you would create a data model e.g. with associated fields or combination of your two tables into one (using joins).

               

              So it all depends on your data and requirements

               

              regards

               

              Marco

                • Re: Script input of two datasets with the same field names

                  Hi Marco,

                   

                  I have, say 50 fields of the two datasets with exactly the same data but 10 fields of completely different data. The difficulty is that I have to CrossTable the final 10 fields first and then do qlikview calculations of the first set of 10 fields divided by the second set of 10 fields. The reason that I cannot do calculations of each cell in Excel is that if so, I won't be able to apply filters, which are the previous 50 fields.

                   

                  Do you know how to resolve this, please?

                   

                  Many thanks,

                   

                  Grace