View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
07236 | Bug reports | Expression Manager | public | 2013-01-27 14:31 | 2013-02-09 17:34 |
Reporter | DenisChenu | Assigned To | DenisChenu | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.00+ | ||||
Fixed in Version | 2.00+ | ||||
Summary | 07236: Unable to concatenate number : + don't work and join is undefined | ||||
Description | EM don't offer possibility to concatenate number | ||||
Steps To Reproduce | Try to have : 10€ or $10 with EM You can import included survey to see the problem. | ||||
Additional Information | In EM: Trying to use {join("A","B")} => show undefined function | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 10 | ||||
Complete LimeSurvey version number (& build) | 130127 | ||||
I will donate to the project if issue is resolved | No | ||||
Browser | not relevant | ||||
Database type & version | not relevant | ||||
Server OS (if known) | debian/linux | ||||
Webserver software & version (if known) | apache | ||||
PHP Version | PHP Version 5.3 | ||||
And for number format, we can using it with another format too. number_format ( QCODE , 2 , ',' , ' ' ) |
|
Documentation says to use join(arg1,arg2) for concatenation. Funny enough this function is not in the function list. |
|
Then move to documentation. Thanks |
|
Problem: |
|
Bug updated |
|
Thomas, any idea on this? |
|
the missing join() function is an oversight. There is an implode() function that can be used instead. The root problem is a (perhaps misguided) effort to get + to work identically in PHP and JavaScript. For the equation "a + b", JavaScript treats + as concat() if a is of type String (even if it is numeric). So, ExpressionManager (one of the RDP_xxx() functions) tries to emulate that behavior in PHP. In retrospect, this may cause more problems than not, so I'd be happy to have + always mean "add" and force users to use join(), or implode() to do concatenation. So, recommendations are: /Tom |
|
Think implode are made for array, not to concatenate string. 1st: join(2 var) , see after for 3.... and more |
|
The EM implode() function does work for contatenating strings (e.g. the function takes an unlimited number of arguments), even if the original PHP implode() function was meant for arrays. |
|
Think some user use + only for addition, sometimes with "10"+"10", then you break their survey. Maybe: And adding join |
|
em_core_helper: |
|
1.92 and 2.0 both already have this code for RDP_EvaluateBinary() case '+': So the problem is likely in em_javascript.js or GetJavaScriptEquivalentOfExpression() |
|
I propose to remove the if ($bBothString) test. Then if both can be numeric Adding else concatenate. |
|
From what I can tell from the forums and from other Limesurvey users I have been working with, "+" is used a lot to concatenate strings/messages and you never know how many users make use of it without us ever having noticed them. Thus, I really wish to not change the way that function is currently used. It might break dozens or hundreds of running surveys. Of course, updating the manual and giving some examples when which functions should best be used, does no harm :-) |
|
Mazi: {"10"+"10"} : 20 Actually we have (Adding join function in php and js after) |
|
The second file show behaviour with same group: |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=11547 |
|
Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=11549 |
|
New version 2.00 build 120206 released. |
|
Fix committed to 2.1 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=11608 |
|
Fix committed to 2.1 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=11609 |
|
LimeSurvey: master 911185fb 2013-01-31 21:17 Details Diff |
Fixed issue 07236: Different behaviour of + in EM in same group or next group Dev: Just fix partially, have to add join function to concatenate 2 number |
Affected Issues 07236 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
LimeSurvey: master 8167e5ae 2013-02-01 10:34 Details Diff |
Fixed issue 07236: Unable to concatenate number : join is undefined Dev: adding join($arg), alias of implode("",$arg) |
Affected Issues 07236 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
mod - scripts/expressions/em_javascript.js | Diff File | ||
LimeSurvey: 2.1 586d0ecc 2013-02-09 17:18 Details Diff |
Fixed issue 07236: Different behaviour of + in EM in same group or next group Dev: Just fix partially, have to add join function to concatenate 2 number |
Affected Issues 07236 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
LimeSurvey: 2.1 ac112709 2013-02-09 17:31 Details Diff |
Fixed issue 07236: Unable to concatenate number : join is undefined Dev: adding join($arg), alias of implode("",$arg) |
Affected Issues 07236 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
mod - scripts/expressions/em_javascript.js | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-01-27 14:31 | DenisChenu | New Issue | |
2013-01-27 14:31 | DenisChenu | File Added: limesurvey_survey_concatenate.lss | |
2013-01-27 14:34 | DenisChenu | Note Added: 23831 | |
2013-01-28 11:06 | c_schmitz | Note Added: 23839 | |
2013-01-28 11:10 | DenisChenu | Note Added: 23842 | |
2013-01-28 11:10 | DenisChenu | Assigned To | => DenisChenu |
2013-01-28 11:10 | DenisChenu | Status | new => assigned |
2013-01-28 11:10 | DenisChenu | Category | Expression Manager => Documentation |
2013-01-28 11:14 | DenisChenu | Note Added: 23843 | |
2013-01-28 11:14 | DenisChenu | Assigned To | DenisChenu => |
2013-01-28 11:14 | DenisChenu | Status | assigned => new |
2013-01-28 11:14 | DenisChenu | Category | Documentation => Expression Manager |
2013-01-28 11:14 | DenisChenu | Summary | Unable to concatenate number => Unable to concatenate number : + don't work and join is undefined |
2013-01-28 11:15 | DenisChenu | Note Added: 23844 | |
2013-01-28 11:16 | DenisChenu | Additional Information Updated | |
2013-01-28 12:06 | c_schmitz | Issue Monitored: TMSWhite | |
2013-01-28 12:06 | c_schmitz | Note Added: 23847 | |
2013-01-28 18:32 | TMSWhite | Note Added: 23849 | |
2013-01-28 19:41 | DenisChenu | Note Added: 23852 | |
2013-01-28 19:42 | DenisChenu | Note Edited: 23852 | |
2013-01-28 19:50 | TMSWhite | Note Added: 23853 | |
2013-01-28 23:07 | DenisChenu | Note Added: 23856 | |
2013-01-28 23:10 | DenisChenu | Note Added: 23857 | |
2013-01-28 23:25 | TMSWhite | Note Added: 23858 | |
2013-01-29 08:03 | DenisChenu | Note Added: 23867 | |
2013-01-29 23:57 | Mazi | Note Added: 23894 | |
2013-01-30 11:11 | DenisChenu | Note Added: 23896 | |
2013-01-30 11:11 | DenisChenu | Note Edited: 23896 | |
2013-01-30 11:12 | DenisChenu | Assigned To | => DenisChenu |
2013-01-30 11:12 | DenisChenu | Status | new => assigned |
2013-01-31 21:13 | DenisChenu | File Added: limesurvey_survey_concatenate_samegroup.lss | |
2013-01-31 21:14 | DenisChenu | Note Added: 23927 | |
2013-01-31 21:20 | DenisChenu | Changeset attached | => LimeSurvey master 911185fb |
2013-01-31 21:20 | DenisChenu | Note Added: 23928 | |
2013-01-31 21:20 | DenisChenu | Resolution | open => fixed |
2013-02-01 10:37 | DenisChenu | Changeset attached | => LimeSurvey master 8167e5ae |
2013-02-01 10:37 | DenisChenu | Note Added: 23931 | |
2013-02-01 10:37 | DenisChenu | Status | assigned => resolved |
2013-02-01 10:37 | DenisChenu | Fixed in Version | => 2.00+ |
2013-02-07 10:52 | c_schmitz | Note Added: 23963 | |
2013-02-07 10:52 | c_schmitz | Status | resolved => closed |
2013-02-09 17:21 | DenisChenu | Changeset attached | => LimeSurvey 2.1 586d0ecc |
2013-02-09 17:21 | DenisChenu | Note Added: 24017 | |
2013-02-09 17:34 | DenisChenu | Changeset attached | => LimeSurvey 2.1 ac112709 |
2013-02-09 17:34 | DenisChenu | Note Added: 24018 | |
2021-08-04 11:25 | guest | Bug heat | 8 => 10 |