Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Numerical input strips zeros

Numerical input strips zeros 4 years 1 week ago #89209

  • jussibus
  • jussibus's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Hello!

I have a problem with LimeSurvey Version 2.00+ Build 121127.

I have a numerical input field in a survey. If I input, for example, '1000' to the field and submit the survey, the db table has '1000.0000000000' but the 'Responses and statistics' in the LimeSurvey admin shows only '1'. I noticed that the the trailing zeros are always stripped when viewing the responses in 'Responses and statistics'.

Is this a bug or did I do something wrong?

Thanks, Jussi
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89213

  • mfs01
  • mfs01's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
On a related note: In my current survey (correctly: a census), I have mandatory 14x7 matrix of numeric fields. When I enter a perfectly valid zero(0) value, this zero will be deleted when I return from a later question group, and therefore this question will be marked as unanswered due to the empty value. Is this a bug or did I miss something?

Using Version 2.00+ Build 121115
The administrator has disabled public write access.

Numerical input strips zeros 4 years 1 week ago #89216

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 6571
  • Thank you received: 1477
  • Karma: 579
jussibus, this is a bug.

Please file a bug report and...
1. Give as much information as possible.
2. Provide step-by-step instructions how to reproduce the problem.
3. Provide screenshots and a sample survey.
4. Post the link to the bug here so we can follow the progress.


mfs, I would wait for the resolution of the bug and retest.
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89223

  • mfs01
  • mfs01's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
Just found this in the tracker for a recently fixed bug (06859: Integer values displayed as floiting point numbers):
LimeSurvey: master be6e85bc
Timestamp: 2012-11-20 09:25:21
Author: Shnoulle
Committer: Denis Chenu

Dev: remove all ending 0 to numeric question type, and remove the . if it's at ending

Of course, trailing zeroes may be removed ONLY if they come AFTER the decimal sign!
This might be the cause for the bug reported by jussibus (not yet in the tracker).
Seems like the culprit is the indiscrimating rtrim() here in application/helpers/common_helper.php
... 	... 	
@@ -1753,11 +1752,11 @@ function getExtendedAnswer($iSurveyID, $sFieldCode, $sValue, $oLanguage)
1753 	1752 	case 'N':
1754 	1753 	     if (trim($sValue)!='')
1755 	1754 	     {
	1755 +          $sValue=rtrim($sValue,"0.");
Last Edit: 4 years 1 week ago by mfs01.
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89287

  • jussibus
  • jussibus's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89321

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9580
  • Thank you received: 1374
  • Karma: 390
jussibus wrote: Resolved :dry:

Thank you
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (use private message).
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89322

  • jussibus
  • jussibus's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 8
  • Karma: 0
Thank you! :)
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89415

  • mfs01
  • mfs01's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
I installed the fixes for issue #6980 by copying the changed source files over the existing ones, then restarting the web server, clearing caches and the like. No change for my case of zeroes vanishing from numeric arrays. Filed a report, issue #6997, complete with survey to reproduce the error.

I hope someone can help, I need a fix really urgent. But sorry, I cannot donate, I am working in a governmental entity, and *donating* is a real pita.
Last Edit: 4 years 1 week ago by mfs01. Reason: Added links to the issue numbers
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89418

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9580
  • Thank you received: 1374
  • Karma: 390
Oups,

It's for Array number.

Give it a try
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (use private message).
The administrator has disabled public write access.

Aw: Numerical input strips zeros 4 years 1 week ago #89432

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9580
  • Thank you received: 1374
  • Karma: 390
mfs wrote:
But sorry, I cannot donate, I am working in a governmental entity, and *donating* is a real pita.
Think LimeSurvey accept governmental donation.

You can contact Carsten directly to see what is possible.

Denis
PS: and you can do little personnal donation ;)
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (use private message).
Last Edit: 4 years 1 week ago by DenisChenu.
The administrator has disabled public write access.

Aw: Re: Aw: Numerical input strips zeros 4 years 6 days ago #89436

  • mfs01
  • mfs01's Avatar
  • Offline
  • Fresh Lemon
  • Posts: 5
  • Karma: 0
DenisChenu wrote:
mfs wrote:
But sorry, I cannot donate, I am working in a governmental entity, and *donating* is a real pita.
Think LimeSurvey accept governmental donation.
The problem is not LimeSurvey accepting donations, but to procure some funds for donation. :unsure:

Give me some time to get this survey out successfully, then I may have a much better standing in this case B)
DenisChenu wrote:
You can contact Carsten directly to see what is possible.

Denis
PS: and you can do little personnal donation ;)
I am just doing my job. Should I pay to get it done? Hey, I'm trying to make ends meet, so I think it's up to someone else to furnish the money that's needed to get the job done. :dry:
Last Edit: 4 years 6 days ago by mfs01.
The administrator has disabled public write access.
Time to create page: 0.463 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form