Page 1 of 1

Looping through groups in a workfile

Posted: Tue Jul 10, 2012 7:46 am
by fboehlandt
Hi everyone,

Instead of looping through series in a group, I am trying to loop through all groups in a workfile. Something along the lines of:

for !i = 1 to wf.@groupcount
%n=wf.@groupname(!i)
'do something here with %n
next

Is this possible?

Thanks for your reply

Re: Looping through groups in a workfile

Posted: Tue Jul 10, 2012 8:00 am
by EViews Gareth

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} ... next

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 12:40 am
by fboehlandt
Great, thanks very much. I shall give this a try

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:10 am
by fboehlandt
Hi Gareth,
I still have a problem with implementation:

This works fine:

Code: Select all

%seriesname = @wlookup("*", "series") for %n {%seriesname} next
This, however, returns "Syntax error in FOR %N"

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} next
Any thoughts on this?

Thanks

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:12 am
by EViews Gareth
Is your copy of EViews up to date?

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:19 am
by fboehlandt
Not sure, what version has this increased functionality for @wlookup?

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:25 am
by fboehlandt
sorry, just ran the update. Working fine now. Should not post questiosn resulting from out-of-date Eview copies. mea culpa
Thanks again

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:44 am
by fboehlandt
Quick one:

I need to reference the name of the group that is currently selected:

Code: Select all

%grouplist = @wlookup("*", "group") for %n {%grouplist} %string1 = 'here groupname next
Thanks once again

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:45 am
by EViews Gareth
um, %n?

Re: Looping through groups in a workfile

Posted: Wed Jul 11, 2012 9:54 am
by fboehlandt
Duh! of course, got it now. thanx