Hi!
I'm wondering if it's possible to check if a specific attribute exists for a group of data series using the @isobject function.
Thinking something like the code below, but my job is crashing saying that "some_attribute" is not defined. I'm sure my syntax is off.
Any help is appreciated!
Thanks,
Bob
string series_list = ""
for %x {%string_of_series}
!x = @isobject({%x}.attr(some_attribute))
if !x = = 0 then
string series_list = {series_list} + %x + " "
else
endif
next
evaluating if an attribute exists using @isobject
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: evaluating if an attribute exists using @isobject
Code: Select all
string series_list = ""
for %x {%string_of_series}
%xx = {%x}.attr(some_attribute)
if @len(%xx)=0 then
string series_list = {series_list} + %x + " "
else
endif
next
Follow us on Twitter @IHSEViews
Re: evaluating if an attribute exists using @isobject
Thanks!
I'm receiving an error message saying the named attribute (in this case UNIT) is not defined.
Here is the exact code, and I've attached the workfile. I'm wondering if it's a case sensitive issue (i.e. I have the attribute defined as "Unit" in the code and the workfile, but it appears the program is looking for "UNIT")?
Thanks again for the help!
group g *
%vars = g.@members
string series_list = ""
for %x {%vars}
%xx = {%x}.attr(Unit)
if @len(%xx)=0 then
string series_list = {series_list} + %x + " "
else
endif
next
I'm receiving an error message saying the named attribute (in this case UNIT) is not defined.
Here is the exact code, and I've attached the workfile. I'm wondering if it's a case sensitive issue (i.e. I have the attribute defined as "Unit" in the code and the workfile, but it appears the program is looking for "UNIT")?
Thanks again for the help!
group g *
%vars = g.@members
string series_list = ""
for %x {%vars}
%xx = {%x}.attr(Unit)
if @len(%xx)=0 then
string series_list = {series_list} + %x + " "
else
endif
next
- Attachments
-
- testCDB042019_regionals.wf1
- (936.18 KiB) Downloaded 217 times
-
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13319
- Joined: Tue Sep 16, 2008 5:38 pm
Re: evaluating if an attribute exists using @isobject
Code: Select all
group g *
%vars = g.@members
string series_list = ""
for %x {%vars}
%xx = {%x}.@attr("Unit")
if @len(%xx)=0 then
series_list = series_list + %x + " "
else
endif
next
Follow us on Twitter @IHSEViews
Who is online
Users browsing this forum: No registered users and 33 guests