Tuesday 19 January 2016

javascript - Including data from multiple rows in CartoDB infowindow?



I have a visualization in CartoDB of a set of data points in table pointlayer. I am using cartodb.js and have a nice map for browser consumption.


When a user clicks on a point, I'd like to run a sql query that returns multiple rows relating to the clicked-upon point, and I'd like to put all that into the infowindow.


select column_a column_b, etc
from anothertable
join pointlayer
on pointlayer.point_id = anothertable.point_id
where
pointlayer.point_id =

anothertable may have 0 or more rows for any point_id



Is this possible with infowindows? Looks to me like the answer is probably no: they are designed for a single row. I suspect that I need to find a solution other than using CartoDB's infowindow (e.g. using Leaflet's popup), but I thought I would ask.


Getting info from multiple rows in single popup of CartoDB? suggests to "actually query the table and get back all data." It doesn't state that the infowindow itself can be used to display it...though I could be reading it incorrectly.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...