Page 1 of 1
@pagecount: Apparently erroneous documentation
Posted: Fri Mar 18, 2011 3:20 am
by Victoria
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)
Re: @pagecount: Apparently erroneous documentation
Posted: Fri Mar 18, 2011 8:02 am
by EViews Gareth
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.
Re: @pagecount: Apparently erroneous documentation
Posted: Mon Mar 21, 2011 3:14 pm
by EViews Gareth
The latest patch changes the behaviour of @pagecount to return 0 if there is no workfile open.
Re: @pagecount: Apparently erroneous documentation
Posted: Fri Mar 25, 2011 5:01 am
by Victoria
Great many thanks for the new patch. It solved the problem, so now the following code works :D
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
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
Code: Select all
if @eqna(@wfname,"") then
'create new workfile
else
%page = @pagename
'something more
endif
Thanks alot for your help and for fixing the issue so quickly! :)
Victoria