5 Replies Latest reply: Dec 9, 2015 1:45 PM by Jonathan Poole RSS

    script error when trying to load new data from sql server database

      I am trying to load a new table from our database into qlik sense, but i keep getting an error in script message even though i made no edits to the script.  all of the fields that were used as the key in my existing tables are present in the new database yet when I try to profile the data it does not find any association between the tables.  Is there something i could be doing wrong?

        • Re: script error when trying to load new data from sql server database
          Sangram Reddy

          Hi Sam,

           

          Please kindly post the script which you are using to load the data, so that we can assist you with the issue you are facing.

          • Re: script error when trying to load new data from sql server database
            Jonathan Poole

            The data manager is producing a load script behind the scenes. You can see the script in the data load editor. What is not always apparent is the different pieces of script that are produced each time you add or change something with the data manager.  In the end, the data load editor has the final record of data load steps that will occur. If there are sections you don't want run, you need to unlock the script and remove those sections.

             

            So as mentioned by sangram, go to the data load editor and on the left you will see the different sections of the script from top to bottom.  It runs the top section, then the next and so forth. The data manager produces an 'auto-generated' section. Copy/paste all sections of the script to get help with the debug.

              • Re: script error when trying to load new data from sql server database

                i figured out what i did wrong... the original person who loaded data created a key using 3 columns, but I did not have the same key created when i tried to load the new data.  i tried again this morning and it looks like it worked.

                 

                thanks!

                • Re: script error when trying to load new data from sql server database

                  i noticed that when i tried to add data that had the same fields in the same order as a table already present in the app, qlik automatically created a "synthetic table" with a "synthetic key" (created from the combination of those fields in the tables) instead of the new key column to associate with the other tables.  this was obviously not what i wanted, so i commented those columns using the // button at the top left of the script editor page and reloaded the table and it worked correctly.

                   

                  Just thought i would share in case anyone else runs into this problem

                    • Re: script error when trying to load new data from sql server database
                      Jonathan Poole

                      Great Sam,

                       

                      Also consider that sometimes a combination key is needed to link to tables to get the right granularity for the link.

                       

                      Consider 2 data sources. One has transactional Sales, another has aggregated margin figures by country and product, but not by City. The following will link the combination of Product and Country between the 2 fact tables.

                       

                      AllSales:

                      Load

                           autonumber(ProductID&CountryID,'ProductCountryKey') as ProductCountryKey,

                           ProductID,

                           CustomerID,

                           CountryID,

                           CityID,

                           Sales

                      from <>

                       

                      CountryMarginByProduct

                      Load

                           autonumber(ProductID&CountryID,'ProductCountryKey') as ProductCountryKey,

                      //     ProductID,

                      //     CountryID,

                           Margin

                      from <>