Welcome to the LimeSurvey Community Forum

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

How to use minest calcluation

  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 11 months ago #152547 by jltrussart11
How to use minest calcluation was created by jltrussart11
Hello,

I'm able to use sum function, but i would like to use - calcultation to find the difference between two sum. How can I do this?
Code:
{if(sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK)<(sum(Temps_H1.NAOK*60,Temps_M1.NAOK)),join("Attention, ",sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK,-sum(Temps_H1.NAOK*60,Temps_M1.NAOK))," minutes are missing"),"")} 

Thanks for your precious help!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago #152565 by tpartner
Replied by tpartner on topic How to use minest calcluation
That looks okay to me. Can you attach small test survey?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: jltrussart11
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 11 months ago #152582 by jltrussart11
Replied by jltrussart11 on topic How to use minest calcluation
Thanks for your precious help.

My first question is to set the lenght of an workshop. So If I set to one hours, it's been convert to 60 minutes.

After that, when I complete the second question, three feedback can be publish:
1) You planning is ok.
2) X minutes are missing
3) You have X minutes over.

At this time, the calculation works but:
#2 and #3 display a - before the number of minutes



Is their a way to get rid of that symbol?

Thanks again for you help!
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago #152587 by tpartner
Replied by tpartner on topic How to use minest calcluation
Try this (untested):

Code:
{if(sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK) < sum(Temps_H1.NAOK*60,Temps_M1.NAOK),join("Attention, ",sum(Temps_H1.NAOK*60,Temps_M1.NAOK)-sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK)," minutes are missing"), "")}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 11 months ago #152588 by jltrussart11
Replied by jltrussart11 on topic How to use minest calcluation
Thanks for your time.

I still got a - before the minutes.
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
6 years 11 months ago #152606 by tpartner
Replied by tpartner on topic How to use minest calcluation
Can you attach a small test survey (not just a question export)?

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • jltrussart11
  • jltrussart11's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
More
6 years 10 months ago #153113 by jltrussart11
Replied by jltrussart11 on topic How to use minest calcluation
Hi,

Thanks for your precious help.

I solved the problem as I define result_if_false in a if function beside using multiples if functions.
Code:
{if(sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK,Minutage_SQ004.NAOK,Minutage_SQ005.NAOK,Minutage_SQ006.NAOK,Minutage_SQ007.NAOK,Minutage_SQ008.NAOK,Minutage_SQ009.NAOK,Minutage_SQ010.NAOK,Minutage_SQ011.NAOK,Minutage_SQ012.NAOK)==(sum(Temps_H1.NAOK*60,Temps_M1.NAOK)),"Excellent! Your timing is ok.",join("Attention, your timing is'nt right. You have a total of ",(sum(Minutage_SQ001.NAOK,Minutage_SQ002.NAOK,Minutage_SQ003.NAOK,Minutage_SQ004.NAOK,Minutage_SQ005.NAOK,Minutage_SQ006.NAOK,Minutage_SQ007.NAOK,Minutage_SQ008.NAOK,Minutage_SQ009.NAOK,Minutage_SQ010.NAOK,Minutage_SQ011.NAOK,Minutage_SQ012.NAOK))," minutes, when the lenght of your workshop is ",sum(Temps_H1.NAOK*60,Temps_M1.NAOK)," minutes."))}
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose