Qlik Community

Ask a Question

GeoAnalytics

Discussion Board for collaboration regarding Qlik GeoAnalytics.

Announcements
April 22, 2PM EST: Learn about GeoOperations in Qlik Sense SaaS READ MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cronico26
Contributor
Contributor

GeoOperations: use CLOSEST with two loaded tables

Hi, 

how can i use the extesion CLOSEST with 2 loaded tables in script?

This is the example:

MyPoints:
LOAD * inline "
id;point
1;[12,57.7]
2;[12.1,57.7]
" (delimiter is ';');

MyPoints2:
LOAD * inline "
id2;point2
1;[12,59.7]
2;[12.1,59.7]

3;....

4;........

" (delimiter is ';');

MyClosestPoints:
Load * Extension GeoOperations.ScriptEval('
Closest(distance="100000", distanceType="car")
DATASOURCE pts INTABLE keyField="id", pointField="point"
DATASOURCE pts INTABLE keyField="id2", pointField="point2"
', MyPoints, MyPoints2);

 

Thank you so much.

Cronico26

Labels (1)
4 Replies
Patric_Nordstrom
Employee
Employee

Only one intable can be used in a SSE operation.

The workaround is to use csv for the second table.

Another option is to merge the two tables together and use merged table as input and then filter the table afterwards to get the right result.

Thanks,

Patric

cronico26
Contributor
Contributor
Author

Thank you very much Patrick for your support.

Using the table above, how I can replace the script of MyPoints2 (Table2) with a CSV file?

Thank you for all your assistance


Cronico26

 

124rooski
Partner
Partner

I'm having the same issue. I was initially able to have routes between 2 points using a spreadsheet and a table from the database, but I have one point (that is 100% in the spreadsheet) not being taken into account on the front-end when loading the script. 

Patric_Nordstrom
Employee
Employee

@cronico26 

Here's an Closest example with the second table exported to csv file:

// Closest example
// Load point data

pts:
LOAD * inline "
id;point
1;[12.3,57.8]
2;[12.2,57.9]
3;[12.0,57.6]
4;[12.8,57.5]
" (delimiter is ';');

pts2:
LOAD * inline "
id2;point2
1;[12,57.7]
2;[12.1,57.7]
" (delimiter is ';');

// Store pts2 into csv file to be able to feed two tables into Closest example

store pts2 into [lib://Patrics Share:Dropbox pn/Share/temp/points.csv] (txt, delimiter is ';');

// Copy direct link from dropbox:
// https://dl.dropbox.com/s/2crzsqtnugzjjes/points.csv?dl=0

MyClosestPoints:
Load * Extension GeoOperations.ScriptEval('
Closest(distance="100000", distanceType="car")
DATASOURCE pts INTABLE keyField="id", pointField="point"
DATASOURCE pts2 CSV 
  	url="https://dl.dropbox.com/s/2crzsqtnugzjjes/points.csv?dl=0", 
    fieldSeparator="SEMICOLON",
    keyField="id2" ,
    geometryField="point2" ,
    geometryType="POINT"
', pts);

See also the attached app.

Thanks,

Patric