<?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: current date as default in a widget while scheduling the notebook in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13269#M7980</link>
    <description>&lt;P&gt;So building on the answer of Hubert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from datetime import date&lt;/P&gt;&lt;P&gt;date_for_widget = date.today()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you use date_for_widget as your default value, you are there.&lt;/P&gt;&lt;P&gt;And ofc you can fill this date_for_widget variable with anything you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can even fetch a value from outside databricks, f.e. with Azure Data Factory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 15 Oct 2021 08:01:31 GMT</pubDate>
    <dc:creator>-werners-</dc:creator>
    <dc:date>2021-10-15T08:01:31Z</dc:date>
    <item>
      <title>current date as default in a widget while scheduling the notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13267#M7978</link>
      <description>&lt;P&gt;I have a scheduled a notebook. can I keep current date as default in widget whenever the notebook run and also i need the flexibility to change the widget value to any other date based on the ad hoc run that I do.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 05:31:04 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13267#M7978</guid>
      <dc:creator>philip</dc:creator>
      <dc:date>2021-10-15T05:31:04Z</dc:date>
    </item>
    <item>
      <title>Re: current date as default in a widget while scheduling the notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13268#M7979</link>
      <description>&lt;P&gt;second parameter is default value, here is example code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data = [{"Category": 'Category A', "ID": 1, "Value": 12.40},
        {"Category": 'Category B', "ID": 2, "Value": 30.10},
        {"Category": 'Category C', "ID": 3, "Value": 100.01}
        ]
df = spark.createDataFrame(data)
&amp;nbsp;
values = [row.ID for row in df.select('ID').collect()]
default_value = str(max(values))
values_str = [str(value) for value in values]
dbutils.widgets.dropdown("ID", default_value, values_str)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 07:17:39 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13268#M7979</guid>
      <dc:creator>Hubert-Dudek</dc:creator>
      <dc:date>2021-10-15T07:17:39Z</dc:date>
    </item>
    <item>
      <title>Re: current date as default in a widget while scheduling the notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13269#M7980</link>
      <description>&lt;P&gt;So building on the answer of Hubert:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from datetime import date&lt;/P&gt;&lt;P&gt;date_for_widget = date.today()&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So if you use date_for_widget as your default value, you are there.&lt;/P&gt;&lt;P&gt;And ofc you can fill this date_for_widget variable with anything you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can even fetch a value from outside databricks, f.e. with Azure Data Factory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Oct 2021 08:01:31 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/current-date-as-default-in-a-widget-while-scheduling-the/m-p/13269#M7980</guid>
      <dc:creator>-werners-</dc:creator>
      <dc:date>2021-10-15T08:01:31Z</dc:date>
    </item>
  </channel>
</rss>

