What is the current row in a list
David McFarlane
mcfarla9 at msu.edu
Mon Feb 23 14:16:53 UTC 2009
OK, let me try to straighten this out.
First, you all need to go back and look at the online E-Basic Help and
look at the "Context" and "List" entries where much of this gets explained.
Second, as you will note there, List.GetAttrib is different than
Context.GetAttrib. List.GetAttrib requires that you supply both a level
number and an attribute name, whereas Context.GetAttrib takes only an
attribute name. So Eliezer's suggestion would not work because it uses
the wrong syntax. It also would not work because a List object only
knows its own attributes (columns) and nothing else.
At least Eliezer knew to submit the attribute name as a quote-enclosed
string, e.g, "Sample", which gets me to point three. As clearly
explained and illustrated in the documentation, the attribute name must
be a *string*, you cannot use a mere variable name or property. Thus,
Greg should simply have used
c.GetAttrib("BlockList.Sample") ' note the use of quotes!
in the first place.
Finally, in reference to some other postings on this topic, there is
exactly one and only one Context object created in any E-Prime program,
and it is automatically given the simple name "c". That Context object
always contains *all* the attributes active at the current time in the
program.
You all really need to take a time out and get some basic lessons in
object-oriented programming.
Regards,
-- David McFarlane, Professional Faultfinder
Eliezer Kanal wrote:
> The error is in how you're calling GetAttrib. "c.GetAttrib" means "get
> attribute from c", or "get attribute from context". Context is sort of
> the base-level storage of the entire experiment. You don't want to get
> an attribute of the context, you want an attribute of BlockList. I
> think you want to try
>
> str(BlockList.GetAttrib("Sample"))
>
> I don't have eprime on this computer, though, so I can't test that.
> Good luck -
>
> Cheers,
> Eliezer Kanal
> PhD Candidate, Bioengineering
> Laboratory for Computational Neuroscience
> University of Pittsburgh
>
>
>
> On Feb 22, 2009, at 10:55 PM, Greg Osenbach wrote:
>
>> Hmm.. This just seems to give me an error
>>
>> "Sample is not a property of the Object"
>>
>> Suggestions?
>>
>> My line of code:
>> Debug.Print "Row = " + str(c.GetAttrib(BlockList.Sample))
>>
>> And:
>> If (c.GetAttrib(BlockList.Sample) = Lot1) Then
>> Lot1CE = CEValue
>> End If
>> If (c.GetAttrib(BlockList.Sample) = Lot2) Then
>> Lot2CE = CEValue
>> End If
>>
>> Thanks,
>> Greg
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To post to this group, send email to e-prime at googlegroups.com
To unsubscribe from this group, send email to e-prime+unsubscribe at googlegroups.com
For more options, visit this group at http://groups.google.com/group/e-prime?hl=en
-~----------~----~----~----~------~----~------~--~---
More information about the Eprime
mailing list