I have 2 apps in automation designer, these app will export the dataset in my local PC.
I want to save the file using current date. I have use %DATEFILE% format but the outcome from this format is : 2021_7_9(yyyy_mm_dd).
I want the format to be like this: 20210709 (yyyymmdd).
One way to do that would be using a query iterator to create your own date variable. In the screenshot below, I dropped a query iterator into automation designer, renamed it to QI, and entered a query to return my variable value:
Then, drop the export dataset action off of that (notice it is a sub-node in the tree, not just a node after the query iterator. This is important). And you'll see that my variable is %QI.DATEFILE%
Thank you for your reply. I have tried using the SQL Iterator, but i found difficult to run the export dataset from sql iterator. I need to double click from SQL Iterator and click run using connection and then it is able to export my desire naming file.
My task scheduler also not function when i set from Query Iterator action.
Please advise the solution for my automation to run with expected result.
Does this work? Rt-click an query iterator, then Run?
If not, make sure that query iterator and export dataset are assigned to the same connection.
Double-click each, then look on the status bar of the properties dialog for each. It sounds like maybe they are different.
Once that is right....schedule the Query Iterator action. Not the Export Dataset action. The Query Iterator will run the Export Dataset.
I have check, on the step 2. When I double click from export dataset. The file display as below
My both query iterator & export dataset action are both in same connection. From schedule, I also have set from Query Iterator but somehow my schedule
Is not running.
It looks like we stumbled across a bug. Using a system variable name (see options -> variables) in a query iterator doesn't work when scheduled. Weird.
Do this:
In your query iterator, change the field name to something else (I changed it from DATEFILE to THE_DATE)
Then, in your export dataset action, change your filename accordingly... so, c:\%QI.THE_DATE%.csv or whatever.
Scheduling of the SPJ_TIPPERTRUCK_QI app should work after that.
Not sure if this query is still valid. Tried above hack and filename still uses variable name as %xxx% so seems the bug using variable is still an issue. Wanted to save a report with date stamp to it.
Thanks for speedy response. New to this forum and TOAD automation designer. Using TOAD 16.2 (sorry should have mentioned that in my last email!)
My steps are:
Query Iterator as select 'Monday_TL_data '||to_char(sysdate,'yyyymmdd') filename from dual
In my Excel Dataset output - saving file as %Q1.filename%.xlsx
My automation run fine but saves the file as %Q1.filename so all runs fine but unable to use value set in variable filename. I even tried different variable names but same result.
When you drop a query iterator on the Automation Designer, it's default name is "Query Iterator1". If you don't rename it, then your variable name would have to be %Query Iterator1.Filename%.
I usually rename the the Query Iterator actions to just QI (the second letter is the letter I, not a one).
You said "Q1.filename". Did you really name it Q1? If not, that's your problem.
I did use the default at first but filename got exported as %Query Iterator1.filename% so tried renaming it but no success. I could user filename%sysdate% but need info on how to convert sysdate from dd/mm/yyyy to a text.
Do you want to use variables to decide which script to run or where to direct output? I see you have tried both.
I have looked at the code for Toad version 16.3. Both should work. From what I can see, it looks like you set it up right. What happens when you try to run it?