Welcome to the LimeSurvey Community Forum

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

Sum a Multiple Numerical Input

  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
10 years 1 month ago #104853 by dweisser
Sum a Multiple Numerical Input was created by dweisser
Hi Team,
I need to sum a multiple numerical input question, and use the sum value in piped text via Expression Manager.
Is there a way to do this? Javascript?

Thank you all,
David
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 1 month ago #104889 by DenisChenu
Replied by DenisChenu on topic Sum a Multiple Numerical Input
Hi,

{sum(that.QCODE)} or {sum(self)} inside question

See manual.limesurvey.org/Expression_Manager....27that.27_variables

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The following user(s) said Thank You: socius
The topic has been locked.
  • dweisser
  • dweisser's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
10 years 1 month ago #104916 by dweisser
Replied by dweisser on topic Sum a Multiple Numerical Input
As always, thank you Denis!
The topic has been locked.
More
6 years 3 months ago #161422 by taltos
Replied by taltos on topic Sum a Multiple Numerical Input
Hi !,

here is a way to have the sum under the multiple numerical input question ? (not in the body of the question)

number of women:
number of men:
Total:

thx for your help !
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 3 months ago #161436 by Joffm
Replied by Joffm on topic Sum a Multiple Numerical Input
Hi, taltos,

It is done out of the box if you use a question of type "array(texts)"

Following "Advanced settings"


And result:


Best regards
Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: socius
The topic has been locked.
More
6 years 1 month ago #164003 by socius
Replied by socius on topic Sum a Multiple Numerical Input
Hi Joffm,

thanks for your hint to the built in column, row and total sums! makes asking and answering questions on budgets really easy. a hidden gem to me - but maybe I should just read the docs ;-)

My only problem here was, that the labels for the Totals ("Total" etc.) are not translated in LS 2.6.4 LTS, whereas in the above example where you use a more recent version of LS they already are.



I'd like to translate these (s. manual.limesurvey.org/Translating_LimeSurvey , translate.limesurvey.org/projects/limesu.../de/default/?filters [term]=total) but for the moment I just wanted to quick (and dirty) replace the "Total" by "Gesamt" and just scripted this:

Code:
<script type="text/javascript" charset="utf-8">
 
$(document).ready(function() {
    replacetotaltext();
});
 
function replacetotaltext() {
    var x = document.getElementsByClassName("answertext total");
    x[0].innerHTML = "Gesamt";
};
 
</script>


This works, but: I'm not a programmer - so my (probably naive) question is: is there an easier way to solve this without scripting (e.g. edit the .mo?), and: are there any possible negative side effects here with the script above? (e.g. naming of function, variables, etc.).


Best,
G
The topic has been locked.
More
6 years 1 month ago #164007 by jelo
Replied by jelo on topic Sum a Multiple Numerical Input
Total is a valid German word too ;-) So I wouldn't call it a missing translation. But Gesamt is more common.

You can modify the language files. But I wouldn't call it easier, since if a update comes along, the files might get overwritten. The workaround looks OK to me.

Not sure if the newest LTS is using Total or Gesamt.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The following user(s) said Thank You: socius
The topic has been locked.
More
6 years 1 month ago #164036 by socius
Replied by socius on topic Sum a Multiple Numerical Input
Hi jelo,

thanks for your response! I use the latest LTS and it says "Total" - which is also German indeed, but I'd prefer "Gesamt" or "Summe" in this case :-) Thanks also for looking at the short script - I guess if I do not accidentally use an existing function name no too bad things should happen here ;-)

Thanks! Best, G
The topic has been locked.
More
6 years 1 month ago #164054 by jelo
Replied by jelo on topic Sum a Multiple Numerical Input

socius wrote: I use the latest LTS and it says "Total"


You stated LS 2.6.4 LTS. The newest LTS is 2.6.6+ 171111. Looks really like an incomplete translation.


The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
More
6 years 1 month ago #164059 by socius
Replied by socius on topic Sum a Multiple Numerical Input
Hi jelo,

thanks! yes, you're right - I'm using LS 2.6.6-lts Build 171111 - I only used column sums and not the grand total, so I did not notice that there is both "Gesamt" and "Total" - is that to be filed as a "bug"? How could I help here? Seems that translations are a bit more complicated than just editing the .mo directly at github.com/LimeSurvey/LimeSurvey/blob/master/locale/de/de.mo - one has to edit the according .po with poedit.

Best, G
The topic has been locked.
More
4 years 8 months ago #186700 by l1bxr02
Replied by l1bxr02 on topic Sum a Multiple Numerical Input
Hi there
I am working on adding multiple sums. I don't see Advanced settings to set the columns for addition. Can I get some help on how to do this? Thanks
Babu Ramabadran
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Online
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
4 years 8 months ago #186702 by Joffm
Replied by Joffm on topic Sum a Multiple Numerical Input
Hi,
which version of LimeSurvey?

Read the manual about
manual.limesurvey.org/Question_type_-_Array_(Texts)




Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose