The documentation (Eviews 7 Command Ref.pdf) states that “@pagecount: returns the number of pages in the current active workfile (0 if no
workfile in memory)”. However, this does not appear to be the behavior of the function in practice. With the following in a program: <if @pagecount = 0 then ...> and no workfile currently opened the program either crashes giving the error message "no workfile" or causes Eviews itself to crash. Is there any way of getting around this unstable behavior or some other way of asking whether there are currently any workfile(s) opened?
(Eviews version 7.1)
@pagecount: Apparently erroneous documentation
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @pagecount: Apparently erroneous documentation
EViews shouldn't crash, and I can't replicate that behaviour - do you have an example?
As for the more basic question, I personally use @wfname to test whether a workfile is open. If it is empty, there is no workfile open.
As for the more basic question, I personally use @wfname to test whether a workfile is open. If it is empty, there is no workfile open.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13585
- Joined: Tue Sep 16, 2008 5:38 pm
Re: @pagecount: Apparently erroneous documentation
The latest patch changes the behaviour of @pagecount to return 0 if there is no workfile open.
Re: @pagecount: Apparently erroneous documentation
Great many thanks for the new patch. It solved the problem, so now the following code works :D
I did also try your proposed solution of using @wfname, however with litle success. Using the code below produced the error "No workfile exists" for every command in the code, but without the unstable behaviour I experienced with @pagecout prior to installation of the new patch
Thanks alot for your help and for fixing the issue so quickly! :)
Victoria
Code: Select all
if @pagecount = 0 then
wfcreate(wf=test, page=nowf) u 1
%today = @strnow("dd/mm/yyyy")
scalar result = -2
result = @uiprompt("No workfile is currently opened. Would you like to create a new workfile?", "OC")
if result = 0 then
result = -2
%frequencies = """y"" ""m"" ""w"" ""d5"""
%wfname = "Untitled" 'name of the workfile
%startdate = "03/10/2005" 'start of sample
%frequency = "m"
result = @uidialog("Caption", "Please enter the detatils for the workfile to be created", "Edit", %wfname, "Name of workfile", _
"List", %frequency, "What frequency would you like for your workfile", %frequencies, _
"Edit", %startdate, "Startdate of workfile (data are only available from October 2005 onwards)")
wfcreate(wf={%wfname}, page=untitled) {%frequency} {%startdate} {%today}
else
stop
endif
endif
Code: Select all
if @eqna(@wfname,"") then
'create new workfile
else
%page = @pagename
'something more
endif
Victoria
Who is online
Users browsing this forum: No registered users and 2 guests
