Welcome to the LimeSurvey Community Forum

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

Having 4 different scorings at the end?!

  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #147997 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
Just adding )) won't work. It will make the last one wrong saying it doesn't support 2 arguments
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148001 by holch
Replied by holch on topic Having 4 different scorings at the end?!
Well, you need to close the parentheses that you opened. Looking at your code you opened a total of 3 "(" but you close only 1.
Code:
{if(Psych == 0, 'Your score is 0 out of 100', if(Psych == 1, 'Your score is 10,6 out of 100', if(Psych == 2, 'Your score is 17,5 out of 100')))}

This should work for the first 3 numbers. you can continue like this until you reach the end. If only those 5 outcomes that you showed before are possible with your calculation, then you only need to create 4 "if" clauses and in the last one you just include the last case out come.

Saying thank you is already enough. Personally I don't need/want anything else. Helping others in the forum is my way to "pay back" to a great open source project. Of course it would always be great if users would give back to the project. There are many ways to support Limesurvey, depending on your pockets and your skill set: contributing code, bug hunting/solving, translating, support others that are less experienced in the forum, sponsor a certain feature or plugin, etc.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Reveb
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148003 by holch
Replied by holch on topic Having 4 different scorings at the end?!

Reveb wrote: Just adding )) won't work. It will make the last one wrong saying it doesn't support 2 arguments


I guess the problem is that you HAVE to give the "else" part.

Try something like this:
{if(score==0, "Your score is 0 out of 100",)}
{if(score==1, "Your score is 10,6 out of 100",)}
{if(score==2, "Your score is 17,5 out of 100",)}
{if(score==3, "Your score is 21,9 out of 100",)}
{if(score==10, "Your score is 37 out of 100",)}
Code:
{if(Psych == 0, 'Your score is 0 out of 100', if(Psych == 1, 'Your score is 10,6 out of 100', if(Psych == 2, 'Your score is 17,5 out of 100','Something went really, really wrong')))}

I guess the complete code would be this:
Code:
{if(Psych == 0, 'Your score is 0 out of 100', if(Psych == 1, 'Your score is 10,6 out of 100', if(Psych == 2, 'Your score is 17,5 out of 100', if(Psych==3, 'Your score is 21,9 out of 100','Your score is 37 out of 100'))))}

This of course will only work if 0, 1, 2, 3 and 10 are the ONLY results possible, because we don't check for the 10 at the end and just assume if it isn't 0, 1, 2 or 3 it must be 10.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Reveb
The topic has been locked.
  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #148004 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
Again thanks then :P

I'll try this, for now you can get a maximum of 34 assesment points in this group so it goes till 34. I'll try working it out cause when i used ELSE and ELSEIF it said it didn't excist.

Well i'll get back to trying over and over and hope for the best ;)

Reveb
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago - 7 years 1 month ago #148006 by holch
Replied by holch on topic Having 4 different scorings at the end?!
I think if there are 34 different assessment levels, then the if loop is gonna be tedious and prone to errors.

I think Denis posted once a solution how he does it to avoid going through many if else loops. I think it was like what I had shown at the beginning, which is a lot "cleaner" I guess.
Code:
{if(Psych==0,"Your score is 0 out of 100","")}

Maybe this works. It should write "your score is 0 out of 100" if Psych is 0, and nothing if it is not.
Then you can go just to the next line. I don't have the time to set up a test here at the moment, this is just guesswork.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Last edit: 7 years 1 month ago by holch.
The topic has been locked.
  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #148008 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
I've tried this but it's not working..

{if(Psych.NAOK==0, "Your score is 0 out of a 100", "er")}
{if(Psych.NAOK==1, "Your score is 10,6 out of a 100", "er")}
{if(Psych.NAOK==3, "Your score is 17,5 out of a 100", "er")}
{if(Psych.NAOK==4, "Your score is 21,9 out of a 100", "er")}

This just shows "er er er er" at the end.
Putting it to single quotes won't change it.

Also i tried this:

{if(Psych.NAOK == 0, 'Your score is 0 out of 100', if (Psych.NAOK == 1, 'Your score is 10,6 out of 100', if (Psych.NAOK == 2, 'Your score is 17,5 out of 100', 'Something went wrong')))}

It wil just show "Something went wrong" all the time..

I don't know what i am doing wrong but it just doesn't seem to be working.

Reveb
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148012 by holch
Replied by holch on topic Having 4 different scorings at the end?!
I am actually inclined not to answer anymore, because of your crosspost. This is a real no-go because it makes different people help you on issues that might have been already solved. I assume this was a beginners mistake for now. But next time this happens I'll just ignore your requests, because this is a waste of valuable resources. You are using up more time of different people instead of concentrating all in one thread (and others can see what has been tried already).

From the other post I see that you actually don't get any results for {Psych}? this was what I was saying before. Try to get one step right before you go to the next. How do you expect our code here to work if the input is already wrong?

Can you export a .lss file that ONLY contains the questions that are relevant for testing this? Set up a small example with one set of questions for creating the base score, then the equation that calculates the base score and then the equation where you test to output the text.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #148014 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
Well i didn't know this wasn't allowed if you look at it the way you do i'm indeed taking time from someone that he is trying things we already tried. But i thougth the developers will probaly be looking in the Development since u told me about Tpartner and Denis etc.

But i also put out the code where we ended so. But still my excuse, i placed TOPIC CLOSED in the other one.

I'll put the file in here with the questions from this group
The topic has been locked.
  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #148015 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
Also the score shows above so Psych actually has 2 in it when i use it but still the "Your score" won't show for Psych.NAOK == 2.
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148016 by holch
Replied by holch on topic Having 4 different scorings at the end?!
Crossposts are generally hated in any forum. If you think that some part of the question would be better in another place (which in this case is not necessary), at least post the link to the other thread in each thread. But here: This thread would be more than enough. Denis and Tpartner also come to this forum and your question is not a question about the development of LS. So now lets forget about this mistake.

I will see if I find the time to look at your example later on.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The following user(s) said Thank You: Reveb
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
7 years 1 month ago #148017 by holch
Replied by holch on topic Having 4 different scorings at the end?!
There are many, many errors in the question Fpsych.

I would only hide an equation question once everything has been tested and is working fine, because it is so much more difficutl to debug a hidden question. There were loads of html codes in the equations. I assume you opened them with the WYSIWYG Editor, which is never a good idea with equations and any code at all.

Always have also a look at the question overview page, because Limesurvey will show you when there is something wrong with your equation and in most cases even give you a good hint what is actually wrong (highlighted in different colors).

Now I am not sure what you are trying to do on the end page, because there are codes that don't match any question, but I assume this might come from deleting parts of the survey.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

The topic has been locked.
  • Reveb
  • Reveb's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
7 years 1 month ago #148018 by Reveb
Replied by Reveb on topic Having 4 different scorings at the end?!
Yes i think your talking about chest etc. they are from different groups, i removed so you don't have to search where you have to be.

For me the survey logic file says No syntax errors detected in this survey.
Also the question says: This question, by itself, does not contain any syntax errors.

I unhided the question and it indeed shows that it already says er er er er from the start..
So there is something going wrong at this part..

If that's what u ment with overview page.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose