test wfopen or wfcreate

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

test wfopen or wfcreate

Postby bhaupt » Fri Mar 16, 2012 5:33 am

Eviews 7.2:

Does wfopen provide some sort of error trapping that would allow me to test to see if a workfile exists, and load it, otherwise wfcreate such a workfile?

Currently, when I open a non-existant workfile I get the message:
[path]\[filename].wf1 not found on disk in "[disk name]
No workfile exists - Use NEW or OPEN to create or load a workfile in "PAGESELECT DAILY".

Pageselect Daily
is the first command after the workfile fails to open.

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

test wfopen or wfcreate

Postby EViews Gareth » Fri Mar 16, 2012 7:19 am

There's nothing more than the general error trapping in programming.

You could use the @fileexist function to test whether the file exists or not.

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: test wfopen or wfcreate

Postby bhaupt » Fri Mar 16, 2012 7:53 am

@fileexist will provide the functionality that I want.

Quick followup:
Ideally if the workfile is already open when I execute my code, I would prefer to *not* re-open the workfile.
is there a workfile command that will identify whether the workfile is already open? I have considered testing the equality of the @wfname property, but that only checks the default (current) workfile.

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

Re: test wfopen or wfcreate

Postby EViews Gareth » Fri Mar 16, 2012 8:08 am

You could try wfuse. That selects the workfile if it is currently open, and opens it if it is not currently open. You have to give it the full path and file name though (see documentation...)

bhaupt
Posts: 25
Joined: Fri May 07, 2010 1:16 pm

Re: test wfopen or wfcreate

Postby bhaupt » Fri Mar 16, 2012 8:57 am

Perfect. Thank you very much.


Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 1 guest