# Parameterization of Date/TimeConfig for DB Table Reader custom SQL

**URL:** <https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159>\
**Category:** KNIME Analytics Platform\
**Created:** [November 11, 2023, 9:54pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159 "2023-11-11T21:54:13Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ebarr](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/919ad9/32.png) [@ebarr](https://forum.knime.com/u/ebarr)\
**Post date:** [November 11, 2023, 9:54pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/1 "2023-11-11T21:54:13Z")

</div>

I have a feeling this is operator error, but I want to extract data from Redshift tables using custom date ranges in SQL.

I’ve added a Date&Time Configuration node to the workflow, and connected the port to the DB Table Selector coming out of the Amazon Redshift Connector node. When I run the workflow with hard coded dates, it works just fine.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/1/e/1e6be22ac9ce4b3c89e93e41f9f7ad7a76637c2a.jpeg)  
I created the simple SQL code:  
 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/9/e/9e30f0caebb5dbe5e9365ec2c7879643b9b3c124.png)

where my objective is to extract data that is dynamic based on the date entered in date/time config.

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/5/9/5975b118bca4e812831ae70d5cf3964c3bb37caa.png)

I’ve tried this with sql\_statement populated and not populated.

What I was expecting to happen was that the query would read the varStartDate and pulling everything starting at that point, but it would seem that it’s assuming the varStartDate is coming directly from the table as it returns errors that the particular date column is not in the table.

Also, when I convert the node to a component so that I can change the date - the varStartDate no longer exports:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/4/c/4cf1f36bd7f7b581d6ed95b04a4c098c0ad7b3a4.jpeg)

What am I missing? I want the date in the date config to populate the SQL query where it indicates ‘date’ \>= varStartDate (the dynamic date that changes based on my input).

---

<div class="post-metadata">

**Author:** ![hmfa](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/9fc29f/32.png) [@hmfa](https://forum.knime.com/u/hmfa)\
**Post date:** [November 11, 2023, 10:16pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/2 "2023-11-11T22:16:39Z")

</div>

> [@ebarr](#):
>
> varStartDate

Hi @ebarr  
Try ‘$${SvarDateStart}$$’  
Br

---

<div class="post-metadata">

**Author:** ![ebarr](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/919ad9/32.png) [@ebarr](https://forum.knime.com/u/ebarr)\
**Post date:** [November 11, 2023, 11:23pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/3 "2023-11-11T23:23:01Z")

</div>

Sorry - I neglected to state I tried that as well -

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/a/1/a17f76dce317c50850a0671b5fa66167e45a6018.jpeg)  
This is where it indicates that the column doesn’t exist.

This is with varStartDate added in flow variables in sql\_statement:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/5/25e18fe12410a506056fdc1d038e6f503dec5ab2.png)

---

<div class="post-metadata">

**Author:** ![ebarr](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/919ad9/32.png) [@ebarr](https://forum.knime.com/u/ebarr)\
**Post date:** [November 11, 2023, 11:28pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/4 "2023-11-11T23:28:54Z")

</div>

ps - when i hard code, the query runs just fine:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/9/b/9b3b0ed7d3c800848976edbf18484fa8663f4c09.png)

This returns last 40 months. The problem is that I need to pull out 5 or so tables and want the flexibility to select various date parameters, but don’t want to open up 5 different nodes to manually change each time and I’m not sure what the issue is wiht the flow variable - is it because this is being inserted into a larger SQL code vs. one simple field?

---

<div class="post-metadata">

**Author:** ![hmfa](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/9fc29f/32.png) [@hmfa](https://forum.knime.com/u/hmfa)\
**Post date:** [November 11, 2023, 11:36pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/5 "2023-11-11T23:36:48Z")

</div>

Hi @ebarr

Remove this variable from DB table selector

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/6/f/6f124471d647e9bc08cdd4d0cc417fcbe0928a25.png)  
and use single cote ‘$${SvarDateStart}$$’ on your variables

Br

---

<div class="post-metadata">

**Author:** ![ebarr](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/919ad9/32.png) [@ebarr](https://forum.knime.com/u/ebarr)\
**Post date:** [November 11, 2023, 11:55pm UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/6 "2023-11-11T23:55:00Z")

</div>

fantastic - thank you. I tried with single quotes, and just about every different way, but apparently didn’t check single quotes AND no flow variable populated. So I had success. The second part of my issue is that I understand I should create a component so that it’s just a double click to set the date. But, you’ll note that the varStartDate is not in the output when I convert to component:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/5/e/5e32b5e11fc1fcabb2b1ad6de476844bef6f829a.jpeg)

when the node is still a node - you’ll note the varStartDate is being passed through:

 ![image](https://forum-cdn.knime.com/uploads/default/original/3X/2/e/2e6d4ee7205e29c6ffbe9f7d574bebf21d0ce6ce.png)

is the expected behavior?i

---

<div class="post-metadata">

**Author:** ![hmfa](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/h/9fc29f/32.png) [@hmfa](https://forum.knime.com/u/hmfa)\
**Post date:** [November 12, 2023, 11:09am UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/7 "2023-11-12T11:09:58Z")

</div>

Hi @ebarr.

Try in the component connecting the Date&Time Configuration to a Merge Variables like this

 ![20231112_110445](https://forum-cdn.knime.com/uploads/default/original/3X/b/7/b72a37230bdf175b9f7acdd78ad1b95065dbd11b.jpeg)

See this expanation from

[![](https://img.youtube.com/vi/v2eefyiwasI/hqdefault.jpg "Simple Metanodes and Wrapped Metanodes") ](https://www.youtube.com/watch?v=v2eefyiwasI)

Br

---

<div class="post-metadata">

**Author:** ![ebarr](https://forum-cdn.knime.com/letter_avatar_proxy/v4/letter/e/919ad9/32.png) [@ebarr](https://forum.knime.com/u/ebarr)\
**Post date:** [November 15, 2023, 4:12am UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/8 "2023-11-15T04:12:46Z")

</div>

appreciate all of the help

---

<div class="post-metadata">

**Author:** ![system](https://forum-cdn.knime.com/uploads/default/original/1X/ab3ccf34482a0329361734a18199390177204f15.png) [@system](https://forum.knime.com/u/system)\
**Post date:** [November 22, 2023, 4:12am UTC](https://forum.knime.com/t/parameterization-of-date-timeconfig-for-db-table-reader-custom-sql/75159/9 "2023-11-22T04:12:51Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
