Possible to get defaut database name in a program?
Posted: Mon Mar 21, 2016 12:30 pm
by etienne
Hi,
Is it possible to get the name of the defaut database in a program? It would be useful to use the @wquery command with this database in an add-in.
Best regards,
Étienne
Re: Possible to get defaut database name in a program?
Posted: Mon Mar 21, 2016 1:53 pm
by EViews Gareth
Don't think there is currently a way to do it. We'll think about adding a @dbname. It is slightly less useful than @wfname though since a database (unless it is a local .edb file) requires more information than just the name to do something with. And we can't return login info etc... with a function :D
Re: Possible to get defaut database name in a program?
Posted: Wed Mar 23, 2016 12:18 pm
by etienne
Yes, having a @dbname command would be fine. For online databases, it should probably return the short name (the alias); for databases in the registry, this would be enough to make queries with @wquery, for example.
To put some context, the current use is for an add-in that resembles 'fetch', but directly imports the series into a new worfile. This saves a few steps to get a quick glance at a few series without having to first open a database, then do one or more queries and export the series into a new workfile. The start/end/freq info required to create the workfile is obtained from the 1st series passed as argument through the use of an @wquery request. So currently, it is mandatory to pass the database to use as an option to the add-in, as opposed to 'fetch', since it is required to use @wquery. If @dbname was available, then @wquery(@dbname, ...) would be used when no database is specified as an option.
So, for the current use, an alternative would be that @wquery uses the default database if, for example, its 1st argument is an empty string. However, having a @dbname function is more versatile.
Étienne
Re: Possible to get defaut database name in a program?
Posted: Wed Mar 23, 2016 12:34 pm
by EViews Gareth
Sounds like an interesting add-in - similar to the object preview window.