Welcome to the LimeSurvey Community Forum

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

how to use convert_value

  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119352 by iscar
how to use convert_value was created by iscar
i just need a sample then i can start.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago - 8 years 11 months ago #119363 by DenisChenu
Replied by DenisChenu on topic how to use convert_value
I use it one time, i have a big list of answer, thgis big list must be categorized in "categori", then i add a Equation question type:
Code:
{convert_value(QUESTION.NAOK,0,
"0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,334,335,336,337,338",
"0,1,1,1,3,3,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,1,1,1,3,1,4,1,1,1,1,1,1,1,3,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,2,1,1,1,2,2,2,2,1,1,1,1,2,2,3,3,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,2,1,1,1,1,1,2,1,2,2,2,2,1,1,1,2,2,2,2,2,1,1,2,2,2,2,1,1,1,2,2,2,2,1,1,1,2,2,1,2,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,3,3")}

I "recode" the QUESTION

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 8 years 11 months ago by DenisChenu.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119372 by iscar
Replied by iscar on topic how to use convert_value
what's the meaning of the 0 after QUESTION.NAOK?
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 11 months ago #119374 by DenisChenu
Replied by DenisChenu on topic how to use convert_value
Heuuuu ...

RTFM : manual.limesurvey.org/Expression_Manager#Implemented_Functions iStrict stric or not comparaison

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 11 months ago #119376 by iscar
Replied by iscar on topic how to use convert_value
forgive me, my IQ is not high.
what's the meaning of stric or not comparaison?
besides 0, what else can the istrict be?

this is wonderful function.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #119427 by iscar
Replied by iscar on topic how to use convert_value
this function is really good:
i always conver the value >=10 to 1.
then how to write EM:
{convert_value(QUESTION.NAOK,0,
"0,1,2,3,4,5,6,7,8,9,10,>10",
it's a function request.

and, i stilll don't what's the meaning of 0
The topic has been locked.
  • tpartner
  • tpartner's Avatar
  • Away
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
8 years 10 months ago #119462 by tpartner
Replied by tpartner on topic how to use convert_value
It seems to me that should be:
Code:
{convert_value(QUESTION.NAOK, 0, "0,1,2,3,4,5,6,7,8,9,10", "10,10,10,10,10,10,10,10,10")}

But I also have no clue what the 0 does.


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
  • iscar
  • iscar's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
8 years 10 months ago #119497 by iscar
Replied by iscar on topic how to use convert_value
even you donnot know this important function,how could make ls sustainable update.
it's risk if we put manythings in JS. nobody know what will happen after update.
The topic has been locked.
More
3 years 11 months ago #196109 by rfaber
Replied by rfaber on topic how to use convert_value
By trial and error I found these results:
The iStrict variable can be 0 or 1 (any other value than 1 will be seen as 0).
If 1, the function will only return exact matching values, otherwise null.
If 0 it will return the nearest value.
E.g. convert_value(age,0,"0,10,20","0,10,20") will return 10 for all ages from 6 to 15, and will return 20 for ages 16 and higher.
Using convert_value(age,1,"0,10,20","0,10,20") will return 10 only if age is 10.

Started using phpsurveyor in 2003.
Now we process >200k survey records each year using LimeSurvey.
(Not so fresh lemon anymore ...)
The following user(s) said Thank You: tpartner
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose