12 Replies Latest reply: Aug 4, 2016 4:56 PM by Youness Ghanim RSS

    "Load" within a for loop with passing dynamic values!

    Youness Ghanim



      I am experimenting with a weather app and I am trying to pull data for the cities present in my excel file, I am trying something like this:


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

      // Load weather data per city
      let vCity = '';
      let noRows = NoOfRows('Relatives')-1;
      for i=0 to $(noRows)
          let vCity=FieldValue('City',$(i));

              $(vCity) as City,
      [humidity/value] as humidity,
      [temperature/min] as min,
      [temperature/max] as max
      [location/country] as country
      Resident Relatives;
      next i


      The above code doesn’t compile and may sound primitive, but it gives an idea of what I am trying to achieve. I included my private weather API key in case someone wants to test with actual data.


      Note that nesting a load statement inside a for loop in Qlik Sense doesn’t work for some reasons!


      What I am trying to achieve is map weather data using city as a key to my friends and relatives data set so that I get weather data per city. Not sure if that is clear!