multi page paperform - limesurvey integration

Asked by GavinErickson on 2018-08-03

I'm running quexf and limesurvey on ubuntu 16.04 / php 7 / mysql

I've created a form in limesurvey, activated it and then exported as pdf / banded xml

Imported into quexf, scanned in succesfully. however the limesurvey integration fails. I enable debugging which chucks out the following

Notice: Undefined variable: assoc in /var/www/quexf/functions/functions.output.php on line 104
***** Request ***** {"method":"get_session_key","params":["myname","mypass"],"id":1} ***** Response ***** {"id":1,"result":"doPfGsQXLfDWW3GiQ~jk2AbYdcgQa7go","error":null} ***** End of Response ***** ***** Request ***** {"method":"list_questions","params":["doPfGsQXLfDWW3GiQ~jk2AbYdcgQa7go","179384"],"id":1} ***** Response ***** {"id":1,"result":[{"id":{"qid":"1","language":"en"},"qid":"1","parent_qid":"0","sid":"179384","type":"F","title":"q6","question":"Over the last 2 weeks, how often have you been bothered by the following problems?<\/span>","preg":"","help":"","other":"N","mandatory":"Y","question_order":"1","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"3"},{"id":{"qid":"2","language":"en"},"qid":"2","parent_qid":"0","sid":"179384","type":"S","title":"q1","question":"Patient Name","preg":"","help":"","other":"N","mandatory":"Y","question_order":"0","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"3","language":"en"},"qid":"3","parent_qid":"0","sid":"179384","type":"D","title":"q2","question":"Patient date of birth","preg":"","help":"dd-mm-yyyy eg 10-02-1970 not 10 Feb 1970","other":"N","mandatory":"Y","question_order":"1","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"4","language":"en"},"qid":"4","parent_qid":"0","sid":"179384","type":"!","title":"q3","question":"Recording point","preg":"","help":"Which treatment does this form refer to?","other":"N","mandatory":"Y","question_order":"2","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"5","language":"en"},"qid":"5","parent_qid":"0","sid":"179384","type":"F","title":"q7","question":"Over the last 2 weeks, how often have you been bothered by any of the following problems?","preg":"","help":"","other":"N","mandatory":"Y","question_order":"1","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"6","language":"en"},"qid":"6","parent_qid":"0","sid":"179384","type":"S","title":"q4","question":"Acupuncturist name","preg":"","help":"","other":"N","mandatory":"Y","question_order":"3","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"7","language":"en"},"qid":"7","parent_qid":"1","sid":"179384","type":"F","title":"SQ001","question":"Feeling nervous, anxious or on edge","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"1","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"8","language":"en"},"qid":"8","parent_qid":"1","sid":"179384","type":"F","title":"SQ002","question":"Not being able to stop or control worrying","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"2","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"9","language":"en"},"qid":"9","parent_qid":"1","sid":"179384","type":"F","title":"SQ003","question":"Worrying too much about different things","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"3","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"10","language":"en"},"qid":"10","parent_qid":"1","sid":"179384","type":"F","title":"SQ004","question":"Trouble relaxing","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"4","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"11","language":"en"},"qid":"11","parent_qid":"1","sid":"179384","type":"F","title":"SQ005","question":"Being so restless that it is hard to sit still","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"5","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"12","language":"en"},"qid":"12","parent_qid":"1","sid":"179384","type":"F","title":"SQ006","question":"Becoming easily annoyed or irritable","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"6","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"13","language":"en"},"qid":"13","parent_qid":"1","sid":"179384","type":"F","title":"SQ007","question":"Feeling afraid as if something awful might happen","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"7","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"1"},{"id":{"qid":"14","language":"en"},"qid":"14","parent_qid":"5","sid":"179384","type":"T","title":"SQ001","question":"Little interest or pleasure in doing things","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"1","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"15","language":"en"},"qid":"15","parent_qid":"5","sid":"179384","type":"T","title":"SQ002","question":"Feeling down, depressed, or hopeless","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"2","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"16","language":"en"},"qid":"16","parent_qid":"5","sid":"179384","type":"T","title":"SQ003","question":"Trouble falling or staying asleep, or sleeping too much","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"3","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"17","language":"en"},"qid":"17","parent_qid":"5","sid":"179384","type":"T","title":"SQ004","question":"Feeling tired or having little energy","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"4","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"18","language":"en"},"qid":"18","parent_qid":"5","sid":"179384","type":"T","title":"SQ005","question":"Poor appetite or overeating","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"5","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"19","language":"en"},"qid":"19","parent_qid":"5","sid":"179384","type":"T","title":"SQ006","question":"Feeling bad about yourself \u2014 or that you are a failure or have let yourself or your family down","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"6","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"20","language":"en"},"qid":"20","parent_qid":"5","sid":"179384","type":"T","title":"SQ007","question":"Trouble concentrating on things, such as reading the newspaper or watching television","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"7","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"21","language":"en"},"qid":"21","parent_qid":"5","sid":"179384","type":"T","title":"SQ008","question":"Moving or speaking so slowly that other people could have noticed? Or the opposite \u2014 being so fidgety or restless that you have been moving .around a lot more than usual","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"8","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"},{"id":{"qid":"22","language":"en"},"qid":"22","parent_qid":"5","sid":"179384","type":"T","title":"SQ009","question":"Thoughts that you would be better off dead or of hurting yourself in some way","preg":null,"help":null,"other":"N","mandatory":"N","question_order":"9","language":"en","scale_id":"0","same_default":"0","relevance":"1","modulename":"","gid":"2"}],"error":null} ***** End of Response ***** array(6) { [1]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "1" ["language"]=> string(2) "en" } ["qid"]=> string(1) "1" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "F" ["title"]=> string(2) "q6" ["question"]=> string(121) "Over the last 2 weeks, how often have you been bothered by the following problems?" ["preg"]=> string(0) "" ["help"]=> string(0) "" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "1" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "3" } [2]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "2" ["language"]=> string(2) "en" } ["qid"]=> string(1) "2" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "S" ["title"]=> string(2) "q1" ["question"]=> string(12) "Patient Name" ["preg"]=> string(0) "" ["help"]=> string(0) "" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "0" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "1" } [3]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "3" ["language"]=> string(2) "en" } ["qid"]=> string(1) "3" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "D" ["title"]=> string(2) "q2" ["question"]=> string(21) "Patient date of birth" ["preg"]=> string(0) "" ["help"]=> string(40) "dd-mm-yyyy eg 10-02-1970 not 10 Feb 1970" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "1" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "1" } [4]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "4" ["language"]=> string(2) "en" } ["qid"]=> string(1) "4" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "!" ["title"]=> string(2) "q3" ["question"]=> string(15) "Recording point" ["preg"]=> string(0) "" ["help"]=> string(40) "Which treatment does this form refer to?" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "2" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "1" } [5]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "5" ["language"]=> string(2) "en" } ["qid"]=> string(1) "5" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "F" ["title"]=> string(2) "q7" ["question"]=> string(89) "Over the last 2 weeks, how often have you been bothered by any of the following problems?" ["preg"]=> string(0) "" ["help"]=> string(0) "" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "1" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "2" } [6]=> array(18) { ["id"]=> array(2) { ["qid"]=> string(1) "6" ["language"]=> string(2) "en" } ["qid"]=> string(1) "6" ["parent_qid"]=> string(1) "0" ["sid"]=> string(6) "179384" ["type"]=> string(1) "S" ["title"]=> string(2) "q4" ["question"]=> string(18) "Acupuncturist name" ["preg"]=> string(0) "" ["help"]=> string(0) "" ["other"]=> string(1) "N" ["mandatory"]=> string(1) "Y" ["question_order"]=> string(1) "3" ["language"]=> string(2) "en" ["scale_id"]=> string(1) "0" ["same_default"]=> string(1) "0" ["relevance"]=> string(1) "1" ["modulename"]=> string(0) "" ["gid"]=> string(1) "1" } }
Notice: Undefined index: formid in /var/www/quexf/functions/functions.output.php on line 155

Notice: Undefined index: rpc_id in /var/www/quexf/functions/functions.output.php on line 155

Notice: Undefined index: filename in /var/www/quexf/functions/functions.output.php on line 155

Notice: Undefined index: vstatus in /var/www/quexf/functions/functions.output.php on line 155
***** Request ***** {"method":"add_response","params":["doPfGsQXLfDWW3GiQ~jk2AbYdcgQa7go","179384",{"0":"gav","1":"12-12-1234","2":"A1","3":"test","4":"A1","5":"A1","6":"A1","7":"A1","8":"A1","9":"","10":"A1","11":"A4","12":"A4","13":"A4","14":"A4","15":"A4","16":"A4","17":"A3","18":"A3","19":"A3","20":"1","21":null,"22":"\/var\/www\/quexf\/scans\/\/Binder1.pdf","23":"Single","179384X1X2":"gav","179384X1X3":"12-12-1234","179384X1X4":"A1","179384X1X6":"test","179384X3X1SQ001":"A1","179384X3X1SQ002":"A1","179384X3X1SQ003":"A1","179384X3X1SQ004":"A1","179384X3X1SQ005":"A1","179384X3X1SQ006":"","179384X3X1SQ007":"A1","179384X2X5SQ001":"A4","179384X2X5SQ002":"A4","179384X2X5SQ003":"A4","179384X2X5SQ004":"A4","179384X2X5SQ005":"A4","179384X2X5SQ006":"A4","179384X2X5SQ007":"A3","179384X2X5SQ008":"A3","179384X2X5SQ009":"A3","":"Single","token":"queXF-1"}],"id":1} ***** Response ***** {"id":1,"result":{"status":"Unable to add response","message":{"179384X1X2":"gav","179384X1X3":"12-12-1234","179384X1X4":"A1","179384X1X6":"test","179384X3X1SQ001":"A1","179384X3X1SQ002":"A1","179384X3X1SQ003":"A1","179384X3X1SQ004":"A1","179384X3X1SQ005":"A1","179384X3X1SQ006":"","179384X3X1SQ007":"A1","179384X2X5SQ001":"A4","179384X2X5SQ002":"A4","179384X2X5SQ003":"A4","179384X2X5SQ004":"A4","179384X2X5SQ005":"A4","179384X2X5SQ006":"A4","179384X2X5SQ007":"A3","179384X2X5SQ008":"A3","179384X2X5SQ009":"A3","token":"queXF-1","submitdate":"2018-08-03 14:32:03","startlanguage":"en"}},"error":null} ***** End of Response *****
Notice: Array to string conversion in /var/www/quexf/functions/functions.output.php on line 178
Json RPC Error: Unable to add response, Array***** Request ***** {"method":"release_session_key","params":["doPfGsQXLfDWW3GiQ~jk2AbYdcgQa7go"],"id":1} ***** Response ***** {"id":1,"result":"OK","error":null} ***** End of Response *****

I set up a couple of short one page test forms, one with a single text input and another with a text and also an array question, and the integration worked fine. I wondered if something is awry with the multiple page form integration? or have i made an error somewhere?

many thanks,

Gavin

Question information

Language:
English Edit question
Status:
Answered
For:
queXF Edit question
Assignee:
No assignee Edit question
Last query:
2018-08-03
Last reply:
2018-08-07
Adam Zammit (adamzammit) said : #1

Hi Gavin,

If it worked for one page test forms, my guess it is that there is a variable name that is not being correctly interpreted by queXF and causing an error when trying to talk to Limesurvey to add a response.

You will be more familiar with your questionnaire than I will - although you have provided most of the required information here - please try and see if there is any mis-matched variable name on the queXF side.

Adam

GavinErickson (gavin-erickson) said : #2

Hi Adam,

i think that is my initial problem - i'm not sure what the format should be for limesurvey to accept a request - i was thinking to simulate an input via postman to limesurvey and check which responses do/ don't work.

quexf seems to generate two versions of response, one with a sort of {q0 => a0, q1 => a1} format, and something like {surveynumberXquestionnumberXsubquestionnumber => answer} format. Is one of these redundant?

Meanwhile I'll try and rebuild the form from scratch in limesurvey, re-export to quexf and see if that helps.

best wishes,

Gavin

GavinErickson (gavin-erickson) said : #3

following on from previous note - I rebuilt the form from scratch in limesurvey, dumped the old database in quexf and reimported the form. The banding appears to be ok. Still the same issue on the limesurvey integration.

inside the limesurvey data table, it looks like the fields are stored as {surveynumberXquestionnumberXsubquestionnumber }, so that would be the correct format to use

GavinErickson (gavin-erickson) said : #4

I found the cause of this - it seems to be a bug parsing a date field, which is stored in a datetime mysql. I'm using a dd-mm-yyyy format (since in the UK).

GavinErickson (gavin-erickson) said : #5

I just put a hack into

functions_output.php ~ 165

//hack for gavin form xx

   if(!empty($data['924341X7X28']))
   {
    $myDateTime = DateTime::createFromFormat('d-m-Y', $data['924341X7X28']);
    $data['924341X7X28'] = $myDateTime->format('Y-m-d');

   }

I think a more global solution would involve incorporating a date format setting in quexf.

GavinErickson (gavin-erickson) said : #6

..or maybe I can solve this by setting in the config..

/**
 * Date time format for displaying
 *
 * see http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
 * for configuration details for DATE_TIME_FORMAT and TIME_FORMAT
 */
if (!defined('DATE_TIME_FORMAT')) define('DATE_TIME_FORMAT','%a %d %b %I:%i%p');

 this definition appears to be used in the actual date centric data fields like those used in quexf "forms" table:
"assigned" and "completed", whereas form date fields are stored as a series of individual characters that are recombined to form the string on export.

Adam Zammit (adamzammit) said : #7

Hi Gavin,

Thanks for reporting this issue. I haven't encountered that problem before . Yes you are right that queXF doesn't have a "native" date type. I'll file this as a bug. I think the best way to handle it would be to add a new "type" of bandable box to queXF - being "Date", and then during data output, queXF will know to effectively run the code you have included in your "hack" to convert the date as written into a date type when communicating with Limesurvey.

Adam

Can you help with this problem?

Provide an answer of your own, or ask GavinErickson for more information if necessary.

To post a message you must log in.