Millisecond Forums

list.mylist.nextvalue causes strange errors: Expression 'text' is invalid. Expression contains an unknown element or property name.

https://forums.millisecond.com/Topic28162.aspx

By Sercan - 1/24/2020

I build a list, like so:

<list category1>
/ items = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16")
/ replace = false
</list>

<list category2>
/ items = ("17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32")
/ replace = false
</list>

<list catalogue>
</list>

<values listbuilder>
/ delaytype = -1
/ ct = 0
/ ct2 = 0
/ tester = "..."
</values>

<block listbuilder>
/ trials = [1=listbuilder]
</block>

<trial listbuilder>
/ ontrialbegin = [
    values.delaytype+=1;
    values.ct+=1;
    if(values.delaytype==4){
        values.delaytype=0;
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.nextvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.nextvalue))
    }else{
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.currentvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.currentvalue));
    }
]
/ timeout=0
/ branch=[
    if(values.ct < 16*4){
        trial.listbuilder
    }
]
</trial>


However, any subsequent call to list.catalogue.nextvalue causes an error and does not provide the next value. It says:

element: list.catalogue
attribute: nextvalue
message: Expression '2F10' is invalid. Expression contains an unknown element or property name.



It seems like Inquisit is trying to parse the list item... but I merely want to assign the item as a string to a variable. What should I do?
By Dave - 1/24/2020

Sercan - 1/24/2020
I build a list, like so:

<list category1>
/ items = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16")
/ replace = false
</list>

<list category2>
/ items = ("17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32")
/ replace = false
</list>

<list catalogue>
</list>

<values listbuilder>
/ delaytype = -1
/ ct = 0
/ ct2 = 0
/ tester = "..."
</values>

<block listbuilder>
/ trials = [1=listbuilder]
</block>

<trial listbuilder>
/ ontrialbegin = [
    values.delaytype+=1;
    values.ct+=1;
    if(values.delaytype==4){
        values.delaytype=0;
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.nextvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.nextvalue))
    }else{
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.currentvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.currentvalue));
    }
]
/ timeout=0
/ branch=[
    if(values.ct < 16*4){
        trial.listbuilder
    }
]
</trial>


However, any subsequent call to list.catalogue.nextvalue causes an error and does not provide the next value. It says:

element: list.catalogue
attribute: nextvalue
message: Expression '2F10' is invalid. Expression contains an unknown element or property name.



It seems like Inquisit is trying to parse the list item... but I merely want to assign the item as a string to a variable. What should I do?

The problem is the mixing of different data types -- integers (values.delaytype) and string literals "O" and "F". Due to the order of operations in your nested concat() statements, the resulting value will attempt to be interpreted as a numerical value, which it actually isn't. The solution is to effectively cast the value to a string data type by enclosing it in quotes.

I've separated it into steps below for clarity:

<list category1>
/ items = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16")
/ replace = false
</list>

<list category2>
/ items = ("17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32")
/ replace = false
</list>

<list catalogue>
</list>

<values listbuilder>
/ delaytype = -1
/ ct = 0
/ ct2 = 0
/ item = ""
/ tester = "..."
</values>

<block listbuilder>
/ trials = [1=listbuilder; 2-129=mytrial]
</block>

<trial listbuilder>
/ ontrialbegin = [
  values.delaytype+=1;
  values.ct+=1;
  if(values.delaytype==4){
   values.delaytype=0;
        values.item = concat(concat(values.delaytype,"F"),list.category1.nextvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
        values.item = concat(concat(values.delaytype,"O"),list.category2.nextvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
  }else{
        values.item = concat(concat(values.delaytype,"F"),list.category1.currentvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
        values.item = concat(concat(values.delaytype,"O"),list.category2.currentvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
  }
]
/ timeout=0
/ branch=[
  if(values.ct < 16*4){
   trial.listbuilder
  }
]
</trial>

<trial mytrial>
/ ontrialbegin = [
    values.item = "";
    values.item = list.catalogue.nextvalue;
]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

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


By Sercan - 1/27/2020

Dave - 1/24/2020
Sercan - 1/24/2020
I build a list, like so:

<list category1>
/ items = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16")
/ replace = false
</list>

<list category2>
/ items = ("17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32")
/ replace = false
</list>

<list catalogue>
</list>

<values listbuilder>
/ delaytype = -1
/ ct = 0
/ ct2 = 0
/ tester = "..."
</values>

<block listbuilder>
/ trials = [1=listbuilder]
</block>

<trial listbuilder>
/ ontrialbegin = [
    values.delaytype+=1;
    values.ct+=1;
    if(values.delaytype==4){
        values.delaytype=0;
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.nextvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.nextvalue))
    }else{
        list.catalogue.appenditem(concat(concat(values.delaytype,"F"),list.category1.currentvalue));
        list.catalogue.appenditem(concat(concat(values.delaytype,"O"),list.category2.currentvalue));
    }
]
/ timeout=0
/ branch=[
    if(values.ct < 16*4){
        trial.listbuilder
    }
]
</trial>


However, any subsequent call to list.catalogue.nextvalue causes an error and does not provide the next value. It says:

element: list.catalogue
attribute: nextvalue
message: Expression '2F10' is invalid. Expression contains an unknown element or property name.



It seems like Inquisit is trying to parse the list item... but I merely want to assign the item as a string to a variable. What should I do?

The problem is the mixing of different data types -- integers (values.delaytype) and string literals "O" and "F". Due to the order of operations in your nested concat() statements, the resulting value will attempt to be interpreted as a numerical value, which it actually isn't. The solution is to effectively cast the value to a string data type by enclosing it in quotes.

I've separated it into steps below for clarity:

<list category1>
/ items = ("01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16")
/ replace = false
</list>

<list category2>
/ items = ("17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32")
/ replace = false
</list>

<list catalogue>
</list>

<values listbuilder>
/ delaytype = -1
/ ct = 0
/ ct2 = 0
/ item = ""
/ tester = "..."
</values>

<block listbuilder>
/ trials = [1=listbuilder; 2-129=mytrial]
</block>

<trial listbuilder>
/ ontrialbegin = [
  values.delaytype+=1;
  values.ct+=1;
  if(values.delaytype==4){
   values.delaytype=0;
        values.item = concat(concat(values.delaytype,"F"),list.category1.nextvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
        values.item = concat(concat(values.delaytype,"O"),list.category2.nextvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
  }else{
        values.item = concat(concat(values.delaytype,"F"),list.category1.currentvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
        values.item = concat(concat(values.delaytype,"O"),list.category2.currentvalue);
        values.item = concat(concat("~"", values.item), "~"");
   list.catalogue.appenditem(values.item);
  }
]
/ timeout=0
/ branch=[
  if(values.ct < 16*4){
   trial.listbuilder
  }
]
</trial>

<trial mytrial>
/ ontrialbegin = [
    values.item = "";
    values.item = list.catalogue.nextvalue;
]
/ stimulusframes = [1=mytext]
/ validresponse = (57)
</trial>

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



That worked. Thanks!