community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.
SOLVED

Output to Access and have current date as part of the table name

Bolide

How can I Output to Access and have current date as part of the table name i.e.,  mytbl_09282018.

 

Thanks in advance for any help.

ACE Emeritus
ACE Emeritus

There are two ways that I can think of off the top, depending on what you want to do. Both take advantage of the "Take File/Table Name From Field" option in the Output Data tool.

 

One configuration is to put the full path in a field (e.g. FileName) -- like this "C:\Temp\data.mdb|mytbl_09282018". In this case, you can set the "Write to File or Database" parameter of the Output Data tool to a fake path (like c:\temp\out.mdb|out) and use the "Change Entire File Path" method.

 

The other configuration is to put just your table name in a field -- like "mytbl_09282018". In this case you would need to set the "Write to File or Database" parameter to the actual path and database name you want, but with a fake table name (like c:\temp\mydata.mdb|out). Then you can use the "Change File/Table Name" method.

 

By the way, this also works for Excel...

Highlighted
Nebula
Nebula

Hi Brad

 

You can configure the output tool to take the table name from a field as in the bottom part of this image

 

output.png

 

The resulting workflow would look like this.  The formula tool updates  [tablename] with today's date and that's the field that's referenced in the Output tool

 

Solution.png The "choose a table" is from an input tool(with the error) that I added to show you that the table was created with today's date in the name

 

The attache workflow is misnamed. I should have called it "Date in table name.yxmd" 

 

Dan

ACE Emeritus
ACE Emeritus

For completeness, I feel like I should point out that you can use other Alteryx tools, functions and features to your advantage.

 

Workflow constants - Using %Engine.WorkflowDirectory% will output your data to the folder where the workflow is saved. %Engine.TempFilePath% writes to a workflow-specific temporary path. This can be great because your output would be deleted once the workflow is closed.

 

Formula tool - Take advantage of the File functions. FileAddPaths() can make things much easier to read and the DateTime functions can give you the current date dynamically.

Labels