Re: get username as variable

69 views
Skip to first unread message

Paulo Serôdio

unread,
May 10, 2022, 7:55:03 AM5/10/22
to Luigi Piccirilli, fo...@googlegroups.com
Two things:

(1) unless your survey is called "survey_name", it won't work and you'll need to replace that bit with the actual name of your survey.

(2) the row should come after the "get code" row, and it should be of type "calculate" or possibly "hidden" .

However, last I checked the get function wasn't working. Maybe this is something you could raise with Ruben and Cyril. At least I never managed to get it to work...

P.





On Tue, May 10, 2022 at 1:14 PM Luigi Piccirilli <picciril...@googlemail.com> wrote:

thank you very much:


so would this work?



type class optional name showif label choice1 choice2 choice3






choice11 choice12 value

get code

code













`r substr(survey_name$session, 1, 7)`
Am 10.05.22 um 13:07 schrieb Paulo Serôdio:

if you create user names with 7 characters:
in the "value" column for the row where you want to store this information, you can write `r substr(survey_name$session, 1, 7)`

if you use a delimiter at the end of the usernames (here I'm assuming you'd be using an exclamation mark, "!")
you can write: `r gsub("(*.)\\!(.*)", "\\1", survey_name$session)`

you'll need to replace "survey_name" with the name of your survey.

Best,

Paulo



On Tue, May 10, 2022 at 12:48 PM piccirilli.luigi <picciril...@googlemail.com> wrote:
Hey. Thank you for your answer

Do you habe an example of the Version with substr() and how to put it in the sheet for the questionnaire? Im quote New to All this 

Greeting 
Luigi


Am 10.05.2022 in 12:45, Paulo Serôdio <pauloadri...@gmail.com> schrieb:

Hi Luigi,

A couple of ideas: if you set usernames with a fixed number of characters, then you can use the substr() function with R to extract, for example, the first 7 characters from the session variable, as in your case below. Alternatively, you can end your usernames with a symbol, for example “_” or “!”, and use gsub() to extract all characters up to that symbol.

Best,

Paulo

On Tue, 10 May 2022 at 12:38, 'Luigi' via formr <fo...@googlegroups.com> wrote:
Hey everyone,

when I create a new user for a run, I assign a username for this participant (for example: 12345PL). In the column "session" is see the session with the Username + rest (12345PLXXX3nbpJWMkVetLM1DtT3ezu9YZA8pefobefpSuvHOc8n3tMjxt-scdqc). How is it possible to fetch only the username (12345PL) as a separate variable? I tried get anchor, bit this doesnt work

Zhank you and greetings
Luigi
--
You received this message because you are subscribed to the Google Groups "formr" group.
To unsubscribe from this group and stop receiving emails from it, send an email to formr+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/formr/2b54e52d-9e65-4dde-b448-43720d47afe6n%40googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted

Mario Reutter

unread,
May 11, 2022, 7:58:15 AM5/11/22
to formr
Hi,

get function is working if you add anything (except an empty string) into the label column but conditioning upon this variable with showif within the same survey does not work last time I checked (see https://groups.google.com/g/formr/c/f8aS8VMilQo/m/hV8DrU-1BAAJ)

Kind regards,
Mario
Reply all
Reply to author
Forward
0 new messages