# Conditions file not taking over position of builder component in Pavlovia

**URL:** <https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352>\
**Category:** Online experiments\
**Created:** [April 16, 2021, 3:18pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352 "2021-04-16T15:18:59Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lucy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lucy/32/10112_2.png) [@Lucy](https://discourse.psychopy.org/u/Lucy)\
**Post date:** [April 16, 2021, 3:18pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/1 "2021-04-16T15:18:59Z")

</div>

URL of experiment: [Lucy Mckeown / Spatial\_localisation · GitLab](https://gitlab.pavlovia.org/Lucy23/spatial_localisation)

Description of the problem:  
The position value I assign to my variable in begin experiment [0,0] remain when the routine begins and the conditions file should take over.

If I run the experiment online without defining the variable position (cue\_coin\_posx), I had the error: unable to convert undefined to a number. See my previous post: [Unable to convert undefined to a number](https://discourse.psychopy.org/t/unable-to-convert-undefined-to-a-number/17940)

Previously making the columns for x and y position separate did work, along with defining the positions as 0 for x and y in begin experiment however it is not working now.  
I receive the error: unable to convert undefined to a number.

I think it may be because I changed the loop structure- the loop in question is trials\_1 (routine is cond1\_trial) and I have defined the variable in begin experiment within this routine in a code component call random\_select\_code1.

I have also tried manually (in begin routine) setting the position of my component cue\_coin, with cue\_coin.setPos[cue\_coin\_posx, cue\_coin\_posy] that is using the two x and y co-ordinates listed in my conditions file but it still produces a position consistent with whatever I set the position value as in begin experiment.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 19, 2021, 1:53pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/2 "2021-04-19T13:53:12Z")

</div>

Question to see if I understood you correctly: you’ve got a variable in a conditions file. You’d like to use that variable to update the position parameter of a stimulus. However, using those variables in your routine gives a problem in terms of it either being undefined or being the value you assigned in a code component, begin routine tab?

---

<div class="post-metadata">

**Author:** ![Lucy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lucy/32/10112_2.png) [@Lucy](https://discourse.psychopy.org/u/Lucy)\
**Post date:** [April 20, 2021, 12:28pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/3 "2021-04-20T12:28:03Z")

</div>

Hi Thomas, yes that is problem I am having.

My current work around is assigning what I want it to be in the code component- but I think that will be a lot more time consuming moving forward than just using conditions files.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 20, 2021, 1:17pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/4 "2021-04-20T13:17:43Z")

</div>

Hi Lucy,

From my crib sheet

> **Don’t** Manipulate to values of variables set by spreadsheets. [rvgart](https://discourse.psychopy.org/t/error-when-importing-conditions-in-nested-loops/14070/7)  
> **Do** Copy the value to a different variable name (e.g. thisFileName=fileName) and use/manipulate the new variable.

---

<div class="post-metadata">

**Author:** ![Lucy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lucy/32/10112_2.png) [@Lucy](https://discourse.psychopy.org/u/Lucy)\
**Post date:** [April 20, 2021, 1:32pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/5 "2021-04-20T13:32:59Z")

</div>

Ah I see thank you.

---

<div class="post-metadata">

**Author:** ![Lucy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lucy/32/10112_2.png) [@Lucy](https://discourse.psychopy.org/u/Lucy)\
**Post date:** [April 20, 2021, 1:59pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/6 "2021-04-20T13:59:01Z")

</div>

The crib sheet is great thanks just getting to grips with what that means.

Does that mean I have to define my conditions file in the code or does it mean that the variables from my conditions file need defining by assigning them new names (if I am using them in a code component).

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [April 20, 2021, 2:14pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/7 "2021-04-20T14:14:47Z")

</div>

> [@How to reference excel column content in JAVA "if" script](https://discourse.psychopy.org/t/how-to-reference-excel-column-content-in-java-if-script/22110/4):
>
> When you create a loop pointing to a spreadsheet every column in that spreadsheet is automatically available as a variable within that loop. A code component can be Python, JavaScript, Both or Auto translated

---

<div class="post-metadata">

**Author:** ![Lucy](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/lucy/32/10112_2.png) [@Lucy](https://discourse.psychopy.org/u/Lucy)\
**Post date:** [April 20, 2021, 2:40pm UTC](https://discourse.psychopy.org/t/conditions-file-not-taking-over-position-of-builder-component-in-pavlovia/22352/8 "2021-04-20T14:40:43Z")

</div>

Okay I will work through that and post when I have the solution. Thanks.
