Formatting subject ID


Author
Message
nidhi_desai
nidhi_desai
New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)
Group: Forum Members
Posts: 8, Visits: 57
I am interested in having a values.marker variable which will contain some digits as the subject ID. I need this variable's 3rd, 4th and 5th digit to indicate the subject ID. So if the subjectID is 123 values.marker should be 11123 and if subjectID is 45 values.marker should be 11045. When I use the following code using format function, I get some set of random numbers in my marker and the not the appropriate subject id. If I use another variable in the script that I had defined like values.faceDuration the formatting this way works. I am not sure why it does not work for script.subjectid and how may I resolve this?

values.marker = 11;
values.marker = concat(values.marker, format("%03d", script.subjectid));
Dave
Dave
Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)Supreme Being (893K reputation)
Group: Administrators
Posts: 10K, Visits: 63K
nidhi_desai - 12/23/2020
I am interested in having a values.marker variable which will contain some digits as the subject ID. I need this variable's 3rd, 4th and 5th digit to indicate the subject ID. So if the subjectID is 123 values.marker should be 11123 and if subjectID is 45 values.marker should be 11045. When I use the following code using format function, I get some set of random numbers in my marker and the not the appropriate subject id. If I use another variable in the script that I had defined like values.faceDuration the formatting this way works. I am not sure why it does not work for script.subjectid and how may I resolve this?

values.marker = 11;
values.marker = concat(values.marker, format("%03d", script.subjectid));

<values>
/ marker = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.marker = 11;
    values.marker = concat(values.marker, format("%03d", evaluate(script.subjectid)));
]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.marker%>")
</text>

You need to make sure the ID is not treated as a string, but as an integer.

nidhi_desai
nidhi_desai
New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)New Member (45 reputation)
Group: Forum Members
Posts: 8, Visits: 57
Dave - 12/23/2020
nidhi_desai - 12/23/2020
I am interested in having a values.marker variable which will contain some digits as the subject ID. I need this variable's 3rd, 4th and 5th digit to indicate the subject ID. So if the subjectID is 123 values.marker should be 11123 and if subjectID is 45 values.marker should be 11045. When I use the following code using format function, I get some set of random numbers in my marker and the not the appropriate subject id. If I use another variable in the script that I had defined like values.faceDuration the formatting this way works. I am not sure why it does not work for script.subjectid and how may I resolve this?

values.marker = 11;
values.marker = concat(values.marker, format("%03d", script.subjectid));

<values>
/ marker = 0
</values>

<trial mytrial>
/ ontrialbegin = [
    values.marker = 11;
    values.marker = concat(values.marker, format("%03d", evaluate(script.subjectid)));
]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

<text mytext>
/ items = ("<%values.marker%>")
</text>

You need to make sure the ID is not treated as a string, but as an integer.

Great, that solved the problem. Thank you.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search