Copy equations from closed wf is not working

For notifying us of what you believe are bugs or errors in EViews.
Please ensure your copy of EViews is up-to-date before posting.

Moderators: EViews Gareth, EViews Moderator

loulouviews
Posts: 55
Joined: Wed Mar 11, 2015 2:19 am

Copy equations from closed wf is not working

Postby loulouviews » Mon Mar 27, 2017 2:39 am

Hi,

I am using EViews 9.5 Enterprise Edition _ Jun 28 2016 build.
Copying equations with a wildcard pattern from a closed workfile lead to the following error :
"Database Error: cannot read object 'EQ_1' due to unrecognized or unsupported object type"

Here is code to reproduce the error :

Code: Select all

%dir = "C:\dir\"
cd %dir
wfcreate(wf=src,page=Q) Q 1990 2010
series s1 = nrnd
equation eq_1.ls s1 c
wfsave src
wfclose src

%src = %dir + "\src.wf1"
wfcreate(wf=dest,page=Q) Q 1990 2010
copy {%src}::Q\eq_* Q\


Opening the workfile and then close it, is working, ie :

Code: Select all

%dir = "C:\dir\"
cd %dir
wfcreate(wf=src,page=Q) Q 1990 2010
series s1 = nrnd
equation eq_1.ls s1 c
wfsave src
wfclose src

%src = %dir + "\src.wf1"
wfopen %src
wfcreate(wf=dest,page=Q) Q 1990 2010
copy {%src}::Q\eq_* Q\


Louis

EViews Steve
EViews Developer
Posts: 443
Joined: Tue Sep 16, 2008 3:00 pm
Location: Irvine, CA

Re: Copy equations from closed wf is not working

Postby EViews Steve » Mon Mar 27, 2017 10:25 am

Hi Louis:

You've stumbled upon one of our "gray" areas when it comes to default name handling. Our COPY documentation currently states:

Code: Select all

When parts of the source or destination specification are not provided, EViews will fill in default values where possible. The default container is the active workfile, unless the “::” prefix is used in which case the default container is the default database. The default page within a workfile is always the active page. The default name for the destination object is the name of the object within the source container.


Even though your particular call to COPY uses a very specific file path to your source workfile, the way our code was designed is that the COPY operation first looks for open workfiles that match the specified filename. If not found, it looks for databases (and aliases) that match the specified name. And unfortunately (or fortunately, depending on who you ask), our EViews database interface supports reading from EViews workfiles (thus we can treat a specific EViews workfile as an EViews database, but only to limited degree).

Thus our code then "opens" the source workfile, but only as an EViews database, with limited object support. This specifically means you can only read series, groups, vectors, matrices, and scalar objects.

We realize that in our attempt to make the COPY operation more flexible (by being able to read from databases) but then also adding support to treat a workfile as a database, we inadvertently created the expectation amongst our users that the COPY operation would work for workfiles that are not open. Our COPY operation was not originally designed with this in mind and thus when you try to do this, you are limited to the objects I mentioned above.

To clear up this confusion, most likely we will have to add support to copy objects from an unopened workfile in the near future, but for now I would explicitly leave open (or re-open) any workfiles you wish to use as a copy source, especially if you need to copy complex objects such as an equation object.

Steve

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11378
Joined: Tue Sep 16, 2008 5:38 pm

Re: Copy equations from closed wf is not working

Postby EViews Gareth » Mon Mar 27, 2017 10:29 am

Adding to Steve's comment, to make it a little more explicit:

The copy command is only intended to be used for copying between currently open workfiles. The fact that some things work when copying between a) non-open workfiles or b) things that aren't workfiles, is just a happy side-effect and should not really be relied upon.
Follow us on Twitter @IHSEViews

loulouviews
Posts: 55
Joined: Wed Mar 11, 2015 2:19 am

Re: Copy equations from closed wf is not working

Postby loulouviews » Wed Mar 29, 2017 1:29 am

Hi Steve and Gareth,

Thank for your detailed explanation.
I will clear my code accordingly.

Best,

Louis


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 2 guests