4 Replies Latest reply: Aug 5, 2016 5:08 AM by Youness Ghanim RSS

    Adjusting a QlikView code to work in Qlik Sense

    Youness Ghanim

      Hi, I have a code that works fine in QlikView, but I am not sure how to adjust it so it can work in Sense, since it requires creating a connection and making it available in the lib, but that implies if I connect to a web link then the URL will be static and I don't want that. I want to be able to pass a variable with different values to the connection. Below is the code in QlikView:

       

      // Load relatives and friends locations
      Relatives:
      LOAD
      "Family member" as Name,
      Relation,
      City
      FROM [C:\Users\YHA\Desktop\WeatherApp\data\Relatives.xlsx]
      (
      ooxml, embedded labels, table is Sheet1);

      for i=1 to NoOfRows('Relatives')-1

      let vCity=FieldValue('City',$(i));

      weatherdata:
      LOAD [forecast/time/day] as [time/day],
      [forecast/time/clouds/value] as [clouds/value],
      [forecast/time/clouds/all] as all,
      [forecast/time/clouds/unit] as [clouds/unit],
      [forecast/time/humidity/value] as [humidity/value],
      [forecast/time/humidity/unit] as [humidity/unit],
      [forecast/time/pressure/unit] as [pressure/unit],
      [forecast/time/pressure/value] as [pressure/value],
      [forecast/time/temperature/day] as [temperature/day],
      [forecast/time/temperature/min] as min,
      [forecast/time/temperature/max] as max,
      [forecast/time/temperature/night] as night,
      [forecast/time/temperature/eve] as eve,
      [forecast/time/temperature/morn] as morn,
      [forecast/time/windSpeed/mps] as mps,
      [forecast/time/windSpeed/name] as [windSpeed/name],
      [forecast/time/windDirection/deg] as deg,
      [forecast/time/windDirection/code] as code,
      [forecast/time/windDirection/name] as [windDirection/name],
      [forecast/time/symbol/number] as number,
      [forecast/time/symbol/name] as [symbol/name],
      [forecast/time/symbol/var] as var,
      [sun/rise] as rise,
      [sun/set] as set,
      [meta/calctime] as calctime,
      [location/name] as City,
      [location/country] as country,
      [location/location/altitude] as altitude,
      [location/location/latitude] as latitude,
      [location/location/longitude] as longitude,
      [location/location/geobase] as geobase,
      [location/location/geobaseid] as geobaseid
      FROM [http://api.openweathermap.org/data/2.5/forecast/daily?q=$(vCity)&mode=xml&units=metric&cnt=1&appid=9d74c2cc68eee64f9109f7e9a6404a1a] (XmlSimple, Table is [weatherdata]);

      NEXT


       

      This is the tricky part for me in Qlik Sense FROM [http://api.openweathermap.org/data/2.5/forecast/daily?q=$(vCity)&mode=xml&units=metric&cnt=1&appid=9d74c2cc68eee64f9109f7e9a6404a1a] (XmlSimple, Table is [weatherdata]);

       

      Many thanks