<!DOCTYPE html><html><head><title></title><style type="text/css">#qt P{margin-top:0px;margin-bottom:0px;}

p.MsoNormal,p.MsoNoSpacing{margin:0}</style></head><body><div>Hi Marcin,<br></div><div><br></div><div>In these cases previously I've used a SQL trick to implement this, by setting a default value for the parameter (of a non-existent ID) and adding an OR clause to the SQL. E.g;<br></div><div><br></div><div>VALIDATION<br></div><div>    "default_pid" "-1"<br></div><div>..<br></div><div><br></div><div>WHERE (pid  = %pid% OR %pid% = -1)<br></div><div><br></div><div>If no value is provided then the SQL will be WHERE (pid  = -1 OR -1 = -1) which will always return True so all records will return.<br></div><div><br></div><div>Seth<br></div><div><br></div><div id="sig62266145"><div class="signature">--<br></div><div class="signature">web:<a href="https://geographika.net">https://geographika.net</a> & <a href="https://mapserverstudio.net">https://mapserverstudio.net</a><br></div><div class="signature">twitter: @geographika<br></div></div><div><br></div><div>On Tue, Nov 28, 2023, at 3:32 PM, Marcin Niemyjski via MapServer-users wrote:<br></div><blockquote type="cite" id="qt" style=""><p class="qt-elementToProof" style="margin-top:0px;margin-bottom:0px;"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">Hello, <br> I would like to define several dimensions for filtering my WMS (Web Map Service). They are based on a PostGIS table from which the service is exposed. Here lies my problem because among the required information to expose, I need to provide the following to
 the map server:</span></span></span></p><ul style="list-style-type:disc;"><li style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;font-size:12pt;color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">wms_dimensionlist: (Mandatory)</span></span></span><br></li><li style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;font-size:12pt;color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">wms_[dimensionname]_item: (Mandatory)</span></span></span><br></li><li style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;font-size:12pt;color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">wms_[dimensionname]_units: (Mandatory)</span></span></span><br></li><li style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;font-size:12pt;color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">wms_[dimensionname]_extent: (Mandatory)</span></span></span><br></li><li style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;font-size:12pt;color:rgb(0, 0, 0);"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">wms_[dimensionname]_default: (Optional)</span></span></span><br></li></ul><p><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">My issue arises because I want to filter my data based on the "product_id" column containing a string. The table
 is large, so it's not possible to provide all the ID values to "wms_productid_extent."</span></span></span><br></p><p class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">So, I thought about using <a href="https://mapserver.org/cgi/runsub.html#table-of-contents" target="_new" id="qt-OWA43134fc7-8bfe-2965-6535-6bc31bf80344" class="qt-OWAAutoLink" style="margin-top:0px;margin-bottom:0px;"> https://mapserver.org/cgi/runsub.html#table-of-contents</a>, but the problem arises with the implementation in the query. I would like to lead to a situation where if I don't provide any filtering parameters (product_id, cloud_cover), the entire data set is
 returned.<br> <br> I do not want to use this:<br> DATA 'geometry from (select * from mrc order by maxcc desc) where pid = '%pid%' as subquerry using unique unique_id using srid=3857'<br> because if I do not provide pid, my query wiill not work.</span></span></span></p><p class="qt-elementToProof"><span style="color:rgb(0, 0, 0);" class="qt-elementToProof"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;"></span></span></span><br></p><p class="qt-elementToProof"><span style="color:rgb(0, 0, 0);" class="qt-elementToProof"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">So, to summarize I'm looking for something like this:<br></span></span></span></p><div class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">DATA 'geometry from (select * from mrc order by maxcc desc) as subquerry using unique
 unique_id using srid=3857'<br> <br> VALIDATION</span></span></span></div><div class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">    'maxCC' '^[0-9](1, 3)$'</span></span></span><br></div><div><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">    'tile' '^.{6}$'</span></span></span><br></div><div><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">    'pid' '^.{65}$'</span></span></span><br></div><div class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">END<br> <br> No default values (except time), if none is provided Mapserver does not filter the data (except time).</span></span></span></div><div class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;"></span></span></span><br></div><div class="qt-elementToProof"><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;">Best,<br> Marcin</span></span></span></div><div id="qt-Signature"><br><table style="margin-top:30px;margin-bottom:30px;width:892.894px;box-sizing:border-box;height:283px;" id="qt-tableSelected0"></table><table id="qt-pbpsiglinktable"><tbody><tr><td><span style="color:rgb(0, 0, 0);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;"><a href="https://outlook.office.com/bookwithme/user/6347c7def05a478ba013ae948648789d@cloudferro.com?anonymous&ep=signature"><img src="https://res.cdn.office.net/assets/bookwithme/misc/CalendarPerson20px.png"></a></span></span></span><br></td><td><br></td><td><span style="color:rgb(0, 120, 212);"><span class="font" style="font-family:Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif;"><span class="size" style="font-size:12pt;"><a href="https://outlook.office.com/bookwithme/user/6347c7def05a478ba013ae948648789d@cloudferro.com?anonymous&ep=signature" style="text-decoration-line:none;text-decoration-style:solid;text-decoration-color:currentcolor;text-decoration-thickness:auto;color:rgb(0, 120, 212);">Book
 time to meet with me</a></span></span></span><br></td><td><br></td></tr></tbody></table></div><div>_______________________________________________<br></div><div>MapServer-users mailing list<br></div><div><a href="mailto:MapServer-users@lists.osgeo.org">MapServer-users@lists.osgeo.org</a><br></div><div><a href="https://lists.osgeo.org/mailman/listinfo/mapserver-users">https://lists.osgeo.org/mailman/listinfo/mapserver-users</a><br></div><div><br></div></blockquote><div><br></div></body></html>