Reply To: Log additional data from table with DashedSentence

PennController for IBEX Forums Support Log additional data from table with DashedSentence Reply To: Log additional data from table with DashedSentence

#4187
Jeremy
Keymaster

Hi Adam,

Unfortunately the only way to add columns to your results file at the moment is to use .log which is only defined on the object returned by PennController(), so it’s not possible to use it with the DashedSentence controller…

One option would be to re-code the DashedSentence controller, but unfortunately there seems to be a bug with having multiple Key elements using the same key within the same trial… So the code below is functional but will fail to log response times!

dashed = (sentence, remove) => {
  let words = sentence.split(' ');
  let blanks = sentence.split(' ').map(w=>w.split('').map(c=>'_').join(''));
  let textName = 'dashed'+words.join('');
  let cmds = [
    newText(textName, blanks.join(' '))
      .print()
  ];
  for (let i = 0; i < words.length; i++){
    cmds.push(newKey('dashed'+i+words[i], " ").settings.log().wait());
    cmds.push(getText(textName).settings.text( blanks.map((w,n)=>(n==i?words[n]:w)).join(' ') ));
  }
  cmds.push(newKey('dashed'+words.length+" end", " ").settings.log().wait());
  cmds.push(getText(textName).settings.text( blanks.join(' ') ));
  if (remove)
    cmds.push(getText(textName).remove());
  return cmds;
}

PennController.Template( "mytable" ,
    row => PennController(
        ...dashed(row.Sentence)
    )
    .log('Condition', row.Condition)
)

I’ll work on fixing the key bug for the next release, and in the meantime I’ll try to see if I can find a hack adapted to your situation

Jeremy