Start a new topic

Excel File Append Date

[This topic is migrated from our old forums. The original author name has been removed]

Is there a way to append a custom date to a file rather than using dbvis-date using @export? Or is there a way to put a custom date into the dbvis-date variable?

[This reply is migrated from our old forums.]

Re: Excel File Append Date
Hi Kanu, Sorry, values in DbVisualizer variables must be hardcoded, no expressions of any kind are supported. Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Excel File Append Date
Thanks Han, Is it possible to use system date instead of hard coding the date in the @echo function. Something like this: @echo ${mydate||sysdate -1||||noshow}$; @export on; @export set filename = "N:\test_${mydate||||||format=[yyyyMMdd]}$.xlsx" format = "XLS" ExcelFileFormat = "ooxml"; select * from test_table; @export off; Thanks, Kanu
[This reply is migrated from our old forums. The original author name has been removed]

Re: Excel File Append Date
Thanks Hans
[This reply is migrated from our old forums.]

Re: Excel File Append Date
Hi Jack, Okay, then I understand. I assume that you want to do this for multiple filename settings in a script but only want to enter the date once. If so, you can use a custom variable instead of the predefined dbvis-date variable: @echo ${mydate||2015-03-06||||noshow}$; @export on; @export set Filename="/tmp/test-${mydate}$.xsl" Format="XLS"; The @echo command creates the variable and sets its value (can be any string) and then the variable is used in the filename setting. In this example, I use the noshow option for the variable, which means I will not be prompted for a value when executing the script. If you want to be prompted, just remove the options part of the variable declaration in the @echo command: @echo ${mydate||2015-03-06}$; Best Regards, Hans
[This reply is migrated from our old forums. The original author name has been removed]

Re: Excel File Append Date
Hans - No I did not mean a custom date format. Let's say the system date is 2/5/2015 but the data I am running is for 2/1/2015. How can the file append date be 2/1/2015 instead of 2/5/2015 which seems to be the default for ${dbvis-date}$. Or what if I am running a data that is a date range and want to append the range to the file name, my_file.2/1/2015_2/3/2015.xlsx
[This reply is migrated from our old forums.]

Re: Excel File Append Date
Hi Jack, If you mean a custom date format, the answer is "yes". You can specify a date format: http://confluence.dbvis.com/display/UG92/Using+DbVisualizer+Variables#UsingDbVisualizerVariables-Pre-definedVariables If you mean something else, please give an example. Best Regards, Hans