Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Optimize code script Qlikview

I need to optimize the following code ,I have number of rows 200 000 000 .

Is there a way to optimize it ?

let noRows = NoOfRows('CustomerTable')-1;

for i=0 to $(noRows)

  let a = peek('Customer',$(i),'CustomerTable');

    let b = peek('City',$(i),'CustomerTable');

    let c = peek('Quantity',$(i),'CustomerTable');

     

  GeocodeResponse:

  LOAD

  status,

  '$(a)' as CustomerName,

  '$(b)' as CustomerCity,

  '$(c)' as CustomerQuantity,

  ([result/geometry/location/lat]) as latitude,

    ([result/geometry/location/lng]) as longitude

  FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]);

next i;

1 Reply
Clever_Anjos
Employee
Employee

Maybe loading only distinct cities (fewer request, faster total load time)

LET x = FieldValueCount('City');

for i = 1 to x

  LET c = FieldValue('City',i);

   Coord:

   LOAD

   '$(c)' as City,

    ([result/geometry/location/lat]) as latitude,

    ([result/geometry/location/lng]) as longitude

  FROM [http://maps.googleapis.com/maps/api/geocode/xml?address=$(b)&sensor=false] (XmlSimple, Table is [GeocodeResponse]);

next;

LEFT join (CustomerTable)

LOAD * resident Coord;

drop table Coord;