GetAttrib fails when filename of list contains an attribute variable

45 views
Skip to first unread message

Mike

unread,
Apr 2, 2022, 9:29:38 PM4/2/22
to E-Prime
Hello,

I have a TrialList that is loaded from text files. The name of this text file is not hard-coded into the Filename field in E-Prime, but instead contains a bracketed name of an attribute that is defined in a higher-order BlockList. For example, BlockList contains a "rule" attribute with levels 1 and 2. Within the TrialList Filename field is list[rule].txt.

All was working well until I tried to combine this setup with the inline script within the experiment on the E-Prime Samples page here: No Repeats on Consecutive Trials (Individual Trial) [30028] – PST Product Service & Support (pstnet.com). This inline script (located within BlockProc) calls TrialList.GetAttrib to pull attributes from the TrialList in order pseudo-randomize the sequence of trials according to some constraints. But, this function fails, specifically when the Filename field contains a bracketed attribute name (instead of having the filename hardcoded).  Here's the error ('correct' is the attribute within TrialList that GetAttrib is trying to get):

Factor Error:
No such attribute "correct"

Line: 1163
Error Number: -990
Error occurred at line number 27 of InLine named 'RandomizeTrials'

Any thoughts on this issue would be helpful.

Thank you for your time,

David McFarlane

unread,
Jul 28, 2022, 5:07:49 PM7/28/22
to e-p...@googlegroups.com
[Addressing some old posts here, probably too late to do any good ...]

Wow, that is an interesting thing to attempt. Offhand, I think your "No
Repeats on Consecutive Trials" code may be trying to access attributes
of TrialList before TrialList has resolved the Filename and loaded its
attributes. And I cannot think of a way around that. I think TrialList
will not resolve Filename and load its attributes until TrialList runs,
but of course you want to use the program code to reorganize the
sequence of TrialList *before* it runs.

Perhaps you do not need to load your TrialList from external files. I
cannot think of when I have used external file loading myself, I always
find other ways to programmatically use alternate Lists, usually by
having all the Lists defined directly in E-Prime. Alternatively, you
could use InLine code to load your attributes from the files directly
into arrays (which the program code does anyway), and then use InLine
code to populate or construct the TrialList.

BTW, the algorithm used in the "No Repeats on Consecutive Trials" is a
particularly inelegant and inefficient approach, essentially a sort of
reverse bogosort (see en.wikipedia.org/wiki/Bogosort).

-- David McFarlane


On 2022-04-02 Sat 9:29 PM, Mike wrote:
> Hello,
>
> I have a TrialList that is loaded from text files. The name of this text
> file is not hard-coded into the Filename field in E-Prime, but instead
> contains a bracketed name of an attribute that is defined in a
> higher-order BlockList. For example, BlockList contains a "rule"
> attribute with levels 1 and 2. Within the TrialList Filename field is
> list[rule].txt.
>
> All was working well until I tried to combine this setup with the inline
> script within the experiment on the E-Prime Samples page here: No
> Repeats on Consecutive Trials (Individual Trial) [30028] – PST Product
> Service & Support (pstnet.com)
> <https://urldefense.com/v3/__https://support.pstnet.com/hc/en-us/articles/115001741928-No-Repeats-on-Consecutive-Trials-Individual-Trial-30028-__;!!HXCxUKc!nK3GPsl7UaOvQ9fX4kzp0yHO6O0DAPOwRagrzkDhhrTp9IafFoRFQ8iuKVapdWzx$>.
Reply all
Reply to author
Forward
0 new messages