Sum a Multiple Numerical Input

More
4 years 8 months ago #104853 by dweisser
dweisser created the topic: Sum a Multiple Numerical Input
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

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #104889 by DenisChenu
DenisChenu replied the 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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .
The following user(s) said Thank You: socius

Please Log in or Create an account to join the conversation.

More
4 years 8 months ago #104916 by dweisser
dweisser replied the topic: Sum a Multiple Numerical Input
As always, thank you Denis!

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #161422 by taltos
taltos replied the 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 !

Please Log in or Create an account to join the conversation.

More
10 months 1 week ago #161436 by Joffm
Joffm replied the 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
Attachments:
The following user(s) said Thank You: socius

Please Log in or Create an account to join the conversation.

More
8 months 4 days ago #164003 by socius
socius replied the 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:

<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
Attachments:

Please Log in or Create an account to join the conversation.

More
8 months 4 days ago #164007 by jelo
jelo replied the 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.

Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
The following user(s) said Thank You: socius

Please Log in or Create an account to join the conversation.

More
8 months 3 days ago #164036 by socius
socius replied the 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

Please Log in or Create an account to join the conversation.

More
8 months 3 days ago #164054 by jelo
jelo replied the 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.


Are you a student conducting a survey? If yes, tell me why you use LimeSurvey?
www.limesurvey.org/forum/development/116...y-you-use-limesurvey
Attachments:

Please Log in or Create an account to join the conversation.

More
8 months 3 days ago #164059 by socius
socius replied the 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

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!