Cannot assign variable in text component from the code

Hi

I have a problem with assigning the variables between the code component and the text component

My goal is to let the code component run when the routine begins, check the condition lang whether its 1 or 2, and assign a string text into another variable asking, which should be present on the screen in the text component. Image are shown below


(I have to combine it into a single image because of weird new user restriction)
however, when I ran it, the asking component did not update itself and still showed “nothing” as a default value at the beginning of the experiment

I believe the loop condition is set correctly and should not be the source of the problem

I think It is because I am not familiar with how the code component and every component run in sequence too

thank you in advance.

edit: the text_2 Text part have $asking

A couple of questions: is lang properly defined in an Excel sheet or code? If not, then that is a big issue here. Please share how, and I might be able to give some advice. If it is an Excel sheet, do you read it in, or is it in a loop? For code, is this it? Do you want the text component to say ‘Nothing’ sometimes, or do you just want English or Tai?

lang are properly defined in the excel file with no space in it

I use this excel sheet to read it in a loop, and lang is loaded as parameter

I set the “nothing” at the begin of experiment because it shows that the asking is not predefined before I put it in. It also let me know that at least the variable is assigned, just not getting updated when the routine begin in the code component. but I actually want only English or Thai

1 Like

Is text_2 set to update every repeat?

1 Like

I set it as constant
I am sorry :sob:
and thank you, now that I set it to every repeat, it works as I want

1 Like