Sum a Multiple Numerical Input

More
5 years 6 months ago #104853 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

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

LimeSurvey Partners
More
5 years 6 months ago #104889 by DenisChenu
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 .
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
5 years 6 months ago #104916 by dweisser
As always, thank you Denis!

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

More
1 year 8 months ago #161422 by taltos
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
1 year 8 months ago #161436 by Joffm
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
1 year 6 months ago #164003 by socius
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
1 year 6 months 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

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

More
1 year 6 months ago #164036 by socius
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
1 year 6 months 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
Attachments:

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

More
1 year 6 months ago #164059 by socius
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.

More
1 month 1 week ago #186700 by l1bxr02
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

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

More
1 month 1 week ago #186702 by Joffm
Hi,
which version of LimeSurvey?

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




Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
Attachments:

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

More
1 month 1 week ago #186705 by l1bxr02
Hello
This is what I am trying to sum.
How can I do this in the simplest way possible?

4.A. 1
(2) ..........................
4.B. (1)
(2)
(3)
4.C. Sum of 4.A(1) through 4.B(3)

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

More
1 month 6 days ago #186713 by Joffm
Don't ask the same question in three different posts.

See my answer in the other one.

Joffm


Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu

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!