Hi;
I create an old date filter to avoid adding old data to the database from sources I regularly get data from.
In summary, what I want to do is. Read today’s date and then add the previous day’s date to the reference date table. Let the workflow read the dates from the table and filter the dates that are past the due date.
today: 14.09.2023
Date to be added to the date table: 13.09.2023
It will continue each day by adding the previous day’s dates one under the other.
date table:
01.
02.
03.
n…
13.09.2023
to be continued
Can you send a sample workflow?
Hi @umutcankurt , presumably your reference table will be stored as a file so that on each invocation it reads the file and appends a new “yesterday” date, if it isn’t already present?
I’m not sure if this is entirely what you had in mind but I’ve bundled a small workflow into a metanode, so that it acts like a simple table. When it executes it finds yesterday’s date and appends it to the end of a csv file stored in the workflow’s data area, and returns the current date table in full.
The additional try-catch around the CSV handles the case when the csv file doesn’t already exist, in which case it gets created.
btw, there are other ways to get yesterday’s date (such as using one of various nodes to retrieve current execution time), but I prefer hacking String Manipulation string(java.time.LocalDate.now().minusDays(1))
and then using String to Date&Time
No problem @umutcankurt . and thanks for marking the post as Solution.
I just uploaded an updated workflow in the above post because I discovered that the CSV Reader wasn’t properly detecting the date format when it reads the data. This meant then when first run, it would return the table as “Local Date” datatype, but on subsequent runs, it returned it as String.
So I modified the transformation setting in the csv reader to explicitly state it is Date. I also added a ROWID node at the end to tidy up the returned rowids.