diff --git a/sandbox/scroll.html b/sandbox/scroll.html
index acdc8589..677db835 100644
--- a/sandbox/scroll.html
+++ b/sandbox/scroll.html
@@ -97,7 +97,11 @@
layer_name = layer.layers[0].options.layer_name,
filter = actions.global.cartodb_filter ? " WHERE "+actions.global.cartodb_filter : "";
- sublayer.setSQL("SELECT * FROM "+layer_name+filter)
+ var sql = layer.layers[0].options.sql;
+ if (!sql) {
+ sql = "SELECT * FROM "+layer_name+filter;
+ }
+ sublayer.setSQL(sql);
self.map.addLayer(layer);
diff --git a/sandbox/slides.html b/sandbox/slides.html
index 65180464..87274986 100644
--- a/sandbox/slides.html
+++ b/sandbox/slides.html
@@ -169,7 +169,11 @@
layer_name = layer.layers[0].options.layer_name,
filter = actions.global.cartodb_filter ? " WHERE "+actions.global.cartodb_filter : "";
- sublayer.setSQL("SELECT * FROM "+layer_name+filter)
+ var sql = layer.layers[0].options.sql;
+ if (!sql) {
+ sql = "SELECT * FROM "+layer_name+filter;
+ }
+ sublayer.setSQL(sql);
self.map.addLayer(layer);