using this example (Surveyjs Library) Surveyjs-recat-quickstart I do not know how can I connect my Mysql database on this example, knowing that I wanted to add a score for each type of question (for example radio question (item1_score = 2, item2_score = 4 ...))
Asked
Active
Viewed 935 times
1 Answers
1
You can check this repo - https://github.com/surveyjs/surveyjs-nodejs Especially this file - https://github.com/surveyjs/surveyjs-nodejs/blob/master/mysqldbadapter.js

TSV
- 7,538
- 1
- 29
- 37
-
` function getObjectFromStorage(tableName, callback) { db.query("SELECT * FROM " + tableName, function(err, result){ if (err) console.log(err); console.log(result); var objects = {}; (result || []).forEach(function(item) { objects[item.id] = item; }); callback(objects); }); }` – RàMi Jun 19 '19 at 13:07
-
I can not retrieve the survey (the example defined in the code) with this code `getObjectFromStorage("surveys", function(objects) { logger.log({ level: 'info', message: "callback getObjectFromStorage "+objects }); if (Object.keys(objects).length > 0) { callback(objects); } else { callback(surveys); } });` – RàMi Jun 19 '19 at 13:10
-
Probably it's better to ask exactly this question in mysql thread (and prepare a MRE - https://stackoverflow.com/help/minimal-reproducible-example) to illustrate your exact problem – TSV Jun 20 '19 at 11:53