Welcome, Guest Username: Password: Remember me

## Using a series of Equation type questions in another calculation 2 years 7 months ago #84743

 tfj OFFLINE Expert Lime Posts: 80 Thank you received: 6 Karma: 5 I have been struggling for the past couple of days on the syntax required for using a series of equation type questions for another calculation. I'm sure it is something simple and I am somewhat embarrassed to ask . . . I have attached a sample survey to calculate the Addiction Severity Index for a series of questions related to Alcohol usage. On the second page of the survey, you will see some of the checks and various calculations I have tried. The first of the calculations works perfectly. (This is the one that says "The ASI for Alcohol Use = XXXX." When I attempt an alternative calculation, however, in order to account for questions that may not have been answered, I get a concatenation, rather than an addition. I even ran checks on the equation questions to make sure they were numeric. This alternative calculation is based upon a series of previous equation questions. I am using version 1.92+ build 120808. Thanks! tfj Attachments: limesurvey...1574.lss (73KB) The administrator has disabled public write access.

## Re: Using a series of Equation type questions in another calculation 2 years 7 months ago #84745

 TMSWhite OFFLINE LimeSurvey Team Posts: 759 Thank you received: 82 Karma: 36 That might be a bug. The JavaScript portion of EM is supposed to concatenate strings, but add numbers when it sees the "+" sign. I never ran into that myself because I always use the sum() function which will solve your immediate problem: ASIAlcohol =`sum(alc30_1_1 / 180, Intox30_1_1 / 180, alcprob30_1_1 / 180, alctroub30 - 1 / 24, (alctximp - 1) / 24, LogAlcExp / 44)` ASIAlc2 =`sum(Alc30Calc, Intox30Calc, AlcProb30Calc, AlcTroub30Calc, AlcTxImpCalc, LogAlcExp / 44)` If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser. Expression Manager (EM): Documentation | Sample Surveys | How Tos | Show Logic File | Upgrading to 1.92+ Excel Style for Survey Structure Import/Export The administrator has disabled public write access.

## Re: Using a series of Equation type questions in another calculation 2 years 7 months ago #84746

 tfj OFFLINE Expert Lime Posts: 80 Thank you received: 6 Karma: 5 Thank you for your help! When I put the following for the question for ASIAlc2: {sum(Alc30Calc, Intox30Calc, AlcProb30Calc, AlcTroub30Calc, AlcTxImpCalc, (LogAlcExp/44)} I get the attached. I tried other combinations, but had no luck. tfj Attachments: ASIAlc2.PNG (64KB) The administrator has disabled public write access.

## Re: Using a series of Equation type questions in another calculation 2 years 7 months ago #84748

 TMSWhite OFFLINE LimeSurvey Team Posts: 759 Thank you received: 82 Karma: 36 If you hover your mouse over the word sum (which is surrounded by a red box), it will tell you that you are missing a closing parenthesis. You need either:`sum(Alc30Calc, Intox30Calc, AlcProb30Calc, AlcTroub30Calc, AlcTxImpCalc, LogAlcExp / 44)` or`sum(Alc30Calc, Intox30Calc, AlcProb30Calc, AlcTroub30Calc, AlcTxImpCalc, (LogAlcExp / 44))` If you depend upon LimeSurvey or the support team, please give generously to our 2012 fundraiser. Expression Manager (EM): Documentation | Sample Surveys | How Tos | Show Logic File | Upgrading to 1.92+ Excel Style for Survey Structure Import/Export Last Edit: 2 years 7 months ago by TMSWhite. The administrator has disabled public write access.

## Re: Using a series of Equation type questions in another calculation 2 years 7 months ago #84749

 tfj OFFLINE Expert Lime Posts: 80 Thank you received: 6 Karma: 5 Oops. Many thanks. It is interesting, though, how my two calculations, the original ASIAlc and the new ASIAlc2 don't quite match, but they are very close -- I'll do some more digging. Thank you for your help . . . I totally forgot that hover part. tfj The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.310 seconds