Start a new topic

Is it possible to default a variable to a dynamic value?

I'm using this in a WHERE clause to prompt a user for the date:


${StartDate||||Date||Where}$


Is it possible to default this to TODAY?


Scott,


Try:


${A||dbvis-date||||Where}$

${B||dbvis-date||||Where format=[yyyyMMdd]}$


Without the format attribute it is the settings in Tool Properties / Data Formats that are used.


In addition these are also supported:


dbvis-time

dbvis-timestamp


Regards


Roger

This did not work.



Scott,


dbvis-date is replaced with the actual value during execute and in the SQL Preview window.


Note also that is is a literal so you will probably need to quote the variable in your SQL.


Regards


Roger

I see what you're saying.  That won't do for my use-case, unfortunately.  I would prefer the parameter value be dynamically loaded.


Thanks anyway.

Hi Scott,


Not sure if this is what you're after, but if you do not want to be prompted for a value you can use the noshow option:


${A||dbvis-date||||noshow}$


Variable options are described here:


http://confluence.dbvis.com/display/UG95/Using+DbVisualizer+Variables


Best Regards,

Hans

No, I want to be prompted for a value, but I want a default value in the entry field.

Hi Scott,


Okay, but then I don't understand why using dbvis-date as Roger suggested doesn't work for you? If you leave it as dbvis-date, it will be replaced by today's date during execution; if you enter another date value, it will used. Please explain what the problem with this is.


Best Regards,

Hans

I don't know how to be more clear.  I just want it to look like this:


qxHux2Lo2ltFTCYxhMPrtXna1fKGUOJS-w.png




And then tomorrow it would have 2016-12-08 and so on...

If it pops up and says "dbvis-date" in the field, it will confuse my users immensely. 

Scott,


Got it :-)


We'll look into it.


Regards


Roger

Scott,


Just to inform you that DbVisualizer 9.5.6 has just been released with support for:


${Date||now||Date}$   > 2012-01-01

${Time||now||Time}$   > 12:12:12

${Timestamp||now||Timestamp}$   > 2012-01-01 12:12:12


Easiest is that you open Help->Check for Update in DbVisualizer to perform the upgrade. 

An alternative is that you download from our web site: http://www.dbvis.com/download/


Regards


Roger



1 person likes this
Login or Signup to post a comment