# Participant info not saved on filename.csv

**URL:** <https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029>\
**Category:** Online experiments\
**Created:** [July 15, 2022, 1:29pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029 "2022-07-15T13:29:39Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [July 15, 2022, 1:29pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/1 "2022-07-15T13:29:39Z")

</div>

Hi,

This has been asked [before](https://discourse.psychopy.org/t/participant-id-saved-in-name-gz-file-not-in-name-csv-file/28573) but there was no solution offered and I just came across the same issue myself (2022.2.1).

The issue is that the value of the variable participant is not saved when this is set in the link. It is saved in the data file as separate column but not in the filename itself.

Also, if in the settings → experiment info dialogue I leave the field for the participant as is i.e. f"{randint(0, 999999):06.0f}", then this will appear in the filename regardless what I set as the participant’s value in the link.

As an example: `https://run.pavlovia.org/Yiannis_A/iat/?participant=yiannis1&session=`

Given that I have done this dozen of times in the past without issues, I tend to believe this is an issue with Pavlovia. I have also tried it with different exps, OS and computers.

Thanks in advance for any pointers

Yiannis

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [July 17, 2022, 9:47am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/2 "2022-07-17T09:47:32Z")

</div>

Hi, does this still happen if you remove f"{randint(0, 999999):06.0f}" from the dialogue box ( and save experiment and resync), and run the task from this example link [IAT [PsychoPy]](https://run.pavlovia.org/Yiannis_A/iat/?participant=yiannis1&session=) ?

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [July 17, 2022, 9:55am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/3 "2022-07-17T09:55:27Z")

</div>

Hi @suelynnmah ,

Thanks for your response. Yes that was the first thing I did actually. I even disabled the dialogue box altogether but had the same behaviour. Of course I synced and cleared cache between different attempts.

Is it something you can replicate from your side? This has now happened in two different task of mine so either there is an issue or I’m doing something wrong myself though I cannot think of any. I’ve done this dozens of times.

Best wishes  
Yiannis

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [July 17, 2022, 10:13am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/4 "2022-07-17T10:13:25Z")

</div>

![Screen Shot 2022-07-17 at 11.09.08](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/b/2/b20a1b2ce476d4fe9bfdbf68b96fdeeda1392d43.png)  
 ![Screen Shot 2022-07-17 at 11.09.33](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/7/0/70f4d27c595cd2f125b9396fabc2c503002908c2.png)

So in this task the f"{randint(0, 999999):06.0f}" was left in when synced to pavlovia and when I’m at the run link, I just removed the numbers generated and typed “test” and as you can see in the second screenshot, test is saved within the filename.

Would you mind sharing your task and I can take a closer look at the settings?

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [July 17, 2022, 11:35am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/5 "2022-07-17T11:35:57Z")

</div>

Thanks for trying this out.

I attach the two exps for which I cannot save participant info in their filenames - zipped as they contain all files necessary to upload and run it yourself if needed)

Many thanks

[OneDrive\_1\_17-07-2022.zip](https://discourse.psychopy.org/uploads/short-url/25umZdVy6medydCiTKiOUulxyDM.zip) (168.1 KB)  
[OneDrive\_2\_17-07-2022.zip](https://discourse.psychopy.org/uploads/short-url/txlrs1Ngl5enGLMFsDFWXoRWHqt.zip) (609.4 KB)

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [July 18, 2022, 9:52am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/6 "2022-07-18T09:52:00Z")

</div>

Hi, I’ve synced your task on my end and the filename saves correctly. Can you replicate this same issue if you push a new version to pavlovia?

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [July 18, 2022, 11:33am UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/7 "2022-07-18T11:33:15Z")

</div>

Hi,

[I am truly at loss here]

I have pushed a new version but the behaviour is the same. I created another project (minimal example,. just a text and a keyboard component) but still the same.

Just to clarify, if I type something in the participant field in the opening window when I start the exp online, it will accept it in that it will save what I typed in the file name. It is only when I pass this info via the link that it will not save it in the filename.

~~Also, rather worryingly I just noticed that:~~

~~ 
- when I pass the participant value via the link e.g. `https://run.pavlovia.org/Yiannis_A/aa_miinimal/?participant=TEST`,  
AND
- in the settings I leave the participant field pre-populated with f"{randint(0, 999999):06.0f}"

 ~~

~~it creates 2 csv datafiles one of which is empty but with a different rand numbers. Below, in the screenshot (I ran it only once) the two csv files are the first two, one of which is empty and the other populated with values. So, not only it ignores the value I set to P via the link but it also creates an extra file.~~

Knowing nothing about JS, the only thing that raises a flag for me is the inverted single quotes in the second line in the snippet below as found in my JS file.

```auto
let expInfo = {
    'participant': `${util.pad(Number.parseFloat(util.randint(0, 999999)).toFixed(0), 6)}`,
    'session': '001',
};

```

Many thanks for any support

Best wishes,  
Yiannis

---

<div class="post-metadata">

**Author:** ![suelynnmah](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@suelynnmah](https://discourse.psychopy.org/u/suelynnmah)\
**Post date:** [July 18, 2022, 12:22pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/8 "2022-07-18T12:22:36Z")

</div>

Hi, I see what you mean now. I’m sorry you’ve been encountering this. This is actually a bug and has been flagged to the dev team.

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [July 18, 2022, 12:26pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/9 "2022-07-18T12:26:01Z")

</div>

Many thanks @suelynnmah and I am sort of glad that this is a bug and not me loosing my sanity 🙂

---

<div class="post-metadata">

**Author:** ![Joseph\_Orr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/joseph_orr/32/6669_2.png) [@Joseph\_Orr](https://discourse.psychopy.org/u/Joseph_Orr)\
**Post date:** [September 20, 2022, 5:18pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/10 "2022-09-20T17:18:46Z")

</div>

I just encountered this as well using 2022.2.4. It looks like it is also causing a problem with redirecting back to Sona, since its using my default participant ID (101) which isn’t a valid participant ID.

I am trying to edit one of the lines in the javascript from:

```auto
let expInfo = {
    'participant': '101',
};

```

to:  
`let expInfo = {'participant': ''};`  
which is how it is in older versions.

I will report back on whether this works.

---

<div class="post-metadata">

**Author:** ![Joseph\_Orr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/joseph_orr/32/6669_2.png) [@Joseph\_Orr](https://discourse.psychopy.org/u/Joseph_Orr)\
**Post date:** [September 22, 2022, 1:58pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/11 "2022-09-22T13:58:11Z")

</div>

I can confirm that clearing the initial setting of participant to the default allows the completedURL to refer back to Sona, but the filename is now missing the participant ID. The participant ID from the URL is contained in the datafile so they can still be processed without a problem.

---

<div class="post-metadata">

**Author:** ![Yiannis](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yiannis/32/35056_2.png) [@Yiannis](https://discourse.psychopy.org/u/Yiannis)\
**Post date:** [September 22, 2022, 2:06pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/12 "2022-09-22T14:06:09Z")

</div>

Thanks for Checking @Joseph_Orr

It’s just unnecessarily laborious to open tens if not hundreds of files to find the data of specific participants to:

- cross-examine with data collected using other platforms (not uncommon)
- provide a copy of the data or delete the data if asked by participants (not uncommon either)

Again thanks for checking, appreciated

BW  
Yiannis

---

<div class="post-metadata">

**Author:** ![shabkr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/shabkr/32/32052_2.png) [@shabkr](https://discourse.psychopy.org/u/shabkr)\
**Post date:** [October 11, 2022, 6:45pm UTC](https://discourse.psychopy.org/t/participant-info-not-saved-on-filename-csv/30029/13 "2022-10-11T18:45:18Z")

</div>

You might be able to add a **Javascript-only** code component as a workaround for this issue. In the `Before Experiment` section of the code component you can add:

```auto
util.addInfoFromUrl(expInfo);

```

and this seems to force the URL parameters to be read before the participant file is created. I briefly tested this in a minimal example in Version 2022.2.4, but have not tried it in a full experiment yet.

Credit to @young1 for [first proposing the workaround](https://discourse.psychopy.org/t/participant-id-not-saving-in-data-file-name/30623/9).

-shabkr
