<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to add a select all option in a Databricks SQL parameter? I would like to use a query-based drop-down list. in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20394#M13749</link>
    <description>&lt;P&gt;This is the right approach. You can avoid mixing the `IN` and `LIKE` syntax in this way for your second query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM table WHERE
('--- All Stores ---'in {{ PARAM }} or store_name in {{ PARAM }})&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then configure `PARAM` to be a multi-select parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also reorder your queries in the backing parameter query so that `--- All Stores ---` always appears at the top of the list, rather than the bottom.&lt;/P&gt;</description>
    <pubDate>Wed, 18 May 2022 16:09:25 GMT</pubDate>
    <dc:creator>susodapop</dc:creator>
    <dc:date>2022-05-18T16:09:25Z</dc:date>
    <item>
      <title>How to add a select all option in a Databricks SQL parameter? I would like to use a query-based drop-down list.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20392#M13747</link>
      <description>&lt;P&gt;So I want to create a select all button in a parameter. The actual parameter has around 200 options because of the size of the database. However, if I want a general summary where you can see all the options I would have to select one by one and that is not efficient. Any ideas?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select
*
from Table
where store in ({{store}}) or ({{store}}) is null&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this but it didn´t let me use the parameter as null. Also, it is important to mention that the parameter uses values from another query where the distinct names of the stores are listed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As shown here: &lt;A href="https://stackoverflow.com/questions/71622404/how-to-add-a-select-all-option-in-a-sql-databricks-parameter-or-if-the-paramete" target="test_blank"&gt;https://stackoverflow.com/questions/71622404/how-to-add-a-select-all-option-in-a-sql-databricks-parameter-or-if-the-paramete&lt;/A&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 23:31:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20392#M13747</guid>
      <dc:creator>StephanieAlba</dc:creator>
      <dc:date>2022-05-16T23:31:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a select all option in a Databricks SQL parameter? I would like to use a query-based drop-down list.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20393#M13748</link>
      <description>&lt;P&gt;You could add&amp;nbsp;'--- All Stores ---'&amp;nbsp;to your list. Here is the query I would use to populate the drop-down. &lt;A href="https://stackoverflow.com/a/72266575/1290485" alt="https://stackoverflow.com/a/72266575/1290485" target="_blank"&gt;S.O. answer here&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT
    store as store_name
FROM
    (
    Select Distinct
      store
    From 
      Table
&amp;nbsp;
    UNION ALL
&amp;nbsp;
    SELECT
      '--- All Stores ---' AS store
    )
ORDER BY
  store_name &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;Next the query that uses the drop down&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Select
  *
FROM 
  Table
WHERE 
  (store in ({{store_name}}) or '{{store_name}}' LIKE '--- All Stores ---')&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Now if you select&amp;nbsp;'--- All Stores ---' you should get all of the stores &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 May 2022 23:34:36 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20393#M13748</guid>
      <dc:creator>StephanieAlba</dc:creator>
      <dc:date>2022-05-16T23:34:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a select all option in a Databricks SQL parameter? I would like to use a query-based drop-down list.</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20394#M13749</link>
      <description>&lt;P&gt;This is the right approach. You can avoid mixing the `IN` and `LIKE` syntax in this way for your second query:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM table WHERE
('--- All Stores ---'in {{ PARAM }} or store_name in {{ PARAM }})&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then configure `PARAM` to be a multi-select parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would also reorder your queries in the backing parameter query so that `--- All Stores ---` always appears at the top of the list, rather than the bottom.&lt;/P&gt;</description>
      <pubDate>Wed, 18 May 2022 16:09:25 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-add-a-select-all-option-in-a-databricks-sql-parameter-i/m-p/20394#M13749</guid>
      <dc:creator>susodapop</dc:creator>
      <dc:date>2022-05-18T16:09:25Z</dc:date>
    </item>
  </channel>
</rss>

