Create a record in the database based on the answers to a questionnaire

Hi, I’m creating an application that allows me to give a personalized (pre-set) plan to users based on a series of questions. I created the questionnaire and created the various customized plans. The problem comes at the moment of assigning the plan, which must be done based on the user’s answers. I had thought of creating a button by attaching a custom action where based on, for example, if record B contains A then put plan C in the record.

Help me, how can I do this?

Hi @jonhsnow,

The implementation will heavily depend on the business logic of the assignments - on how users’ answers affect the choice of a preferred plan.
For example:

  • in a questionnaire, each question has a “score”. Scores are summarized and one of the plans is suggested based on the result range (e.g. Plan A - 0 to 10, Plan B, 11 to 20, etc.).
  • similar approach, but where score starts from 0 and final score is ranged between -1 and 1 (so each answer adds / deducts a certain amount from a final score).
  • more complex score calculations using formulas, where final score may depend on some complex formula(s). As an example - fitness / weight control programs based on weight, height, daily activity, etc.

Some cases can be implemented on Adalo, and some cases may require an external platform to do the calculations. But again, this all depends on your requirements.

Best,
Victor.

My conditionals are based on the answers. I’ll give you an example:
Moisturizing treatment
Conditions for assignment:
Priority: Hair
Hair Problems: Dry Hair
Skin Type: Dry or Normal
Skin Problems: Dandruff or None

Hi @jonhsnow,

Unfortunately it is difficult to give a detailed advice based on the information provided. In questionnaires, the results are usually based on user’s answers (like in my examples). But the approach will depend on number of questions and complexity of “dependencies” between them.

In your case you have a series of questions, like:
“area of treatment?” → Hair
“what hair problems do you have?” → Dry Hair
“what is your skin type?” → Dry OR Normal (2 possible answers to get to next level)
“what skin problems do you have?” → Dandruff OR None (2 possible answers to get to next level)
If all other question series have similar structure and you can draw a “tree” from “root” questions to final answers, than you can try building this using a collection of questions with relationships:

  • question can be a “start question”, regular question or “finish” question (in fact it will be a result)
  • for “start” questions, no need for any relationships
  • other questions have a relationship to a “parent” question
    Then you can build a screen series (or even one screen, but it’s more complex) to display questions. A very straightforward approach for 4 question “levels” will be:
  • have a screen A with a list of “starting” questions. Link a list entry to screen B;
  • screen B will be a list of questions, filtered by Question (relationship) → ID is equal to Current Question → ID. “Current Question” record “arrives” from Screen A, so we need to display only those questions, whose “parent” is this selected question. Link to screen C.
  • screen C has similar logic like screen B
  • screen D has similar logic like screen C & B, but as this is a final screen, you will display a “finish” questions there.
    As I said this is a straightforward approach and it could be expanded further and optimized.

However, for more complex questions’ logic it might be a good idea to use some other products as this is more like an Expert System (early AI).

Best,
Victor.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.