Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

replace placeholder linked to an answer to another question

  • Thomassie
  • Thomassie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 8 months ago #125779 by Thomassie
Hey Tony,

I can't make it to work. The placeholder keeps turning up empty. I copyed the string of code down here, I think I copied your code literally.

what's wrong ? can you help ?


heeft zich hulpvaardig (aanspreekbaar en luisterend) opgesteld en/of heeft mij/de cliënt geholpen op een vriendelijke manier en/of doorverwezen. heeft antwoord op mijn vragen en de nodige praktische informatie gegeven. {if (substr(A41, 1, 0)=='V', 'she', if (substr(A41, 1, 0)=='M', 'he', ' '))} heeft het gevraagde werk afgeleverd binnen de afgesproken periode.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 8 months ago - 9 years 8 months ago #125783 by tpartner
Well, I'm confused. Now you're back to one question?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 9 years 8 months ago by tpartner.
The topic has been locked.
  • Thomassie
  • Thomassie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 8 months ago #125788 by Thomassie
No no, there is still need for the other questions (A42,A43,A44,...) but to save me some time I'm first trying with the one code to see if that works and then build further, but the code with just A41 is already giving error, to be precise it gives nothing.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 8 months ago #125789 by tpartner
Please attach a small sample survey with just those name questions and the following text question.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Thomassie
  • Thomassie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 8 months ago #125792 by Thomassie
Here you go Tony,
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 8 months ago #125805 by tpartner
Oops, sorry, somewhere in the cutting and pasting I got the parameters of the substr function backwards. And since you have conditional questions we should also add ".NAOK" to the Expression Manager variables.

Code:
{if(substr(A41.NAOK, 0, 1) == 'V', 'she', if(substr(A41.NAOK, 0, 1) == 'M', 'he', ''))}
{if(substr(A42.NAOK, 0, 1) == 'V', 'she', if(substr(A42.NAOK, 0, 1) == 'M', 'he', ''))} 
{if(substr(A43.NAOK, 0, 1) == 'V', 'she', if(substr(A43.NAOK, 0, 1) == 'M', 'he', ''))}
{if(substr(A44.NAOK, 0, 1) == 'V', 'she', if(substr(A44.NAOK, 0, 1) == 'M', 'he', ''))}

Try this survey:

File Attachment:

File Name: limesurvey...2822.lss
File Size:74 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • Thomassie
  • Thomassie's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
9 years 8 months ago #125831 by Thomassie
Thanks Tony,

it works perfect. Just out of interest, what does .NAOK do in the code ?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 8 months ago #126045 by DenisChenu
We have a manual , it's great if you read it : www.limesurvey.org/manual/Expression_Man...#Access_to_Variables

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
9 years 6 months ago #129236 by Ben_V
Hi,
I'm trying without success to use " substr" in a multiple choice question to count easily Tony's boys & girls friends.
Is this possible ?

Thanks...

Note: attached sample "substr/checkboxes" is for the moment also present/inactivate at the demo platform)

Benoît

EM Variables => bit.ly/1TKQyNu | EM Roadmap => bit.ly/1UTrOB4
Last Releases => 2.6x.x goo.gl/ztWfIV | 2.06/2.6.x => bit.ly/1Qv44A1
Demo Surveys => goo.gl/HuR6Xe (already included in /docs/demosurveys)
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #129244 by tpartner
I don't think you can get there with Expression Manager because (as far as I know) there is no way to selectively access the checked items sub-question codes.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
9 years 6 months ago - 9 years 6 months ago #129248 by DenisChenu
Hi ,

Usage of that and sub-suffix sq_:
Boys: {count(that.Q1.sq_M)} => count(that.Q1.sq_M)
Girls: {count(that.Q1.sq_F)} => count(that.Q1.sq_F)
Code:
demo.limesurvey.org/index.php?r=admin/questions/sa/editquestion/surveyid/231563/gid/32/qid/172

www.limesurvey.org/manual/Expression_Man....27that.27_variables

:)

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 9 years 6 months ago by DenisChenu.
The following user(s) said Thank You: Ben_V
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
9 years 6 months ago #129250 by tpartner
??? How does that work? Surely you should need the entire sub-question code when using a sub-selector with that.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose