Topics and lessons

Storing workflow progress for later sessions

If a user would be working on a questionnaire, it would be nice if the user could continue where he left off in the questionnaire when he signs in the next day. A way to achieve this is to store certain data in the User profile (the data item User).

To do this, we first use the data item User to store the current questionnaire. Then, we use the flow part My current question to find the question in that questionnaire that he needs to answer.

In this lesson:

  1. Data structure
  2. User profile
  3. Only show questions that need to be answered

1. Data structure

We have the following data items in the application:

  1. Questionnaire: the questionnaires that are used in the organisation.
  2. Question: the questions that belong to them.
  3. My Questionnaire: the questionnaires that are assigned to users.
  4. My question: copies of the questions that are assigned to users.
database-questionnaire

When a teacher assigns a questionnaire to a student, a flow partcopies therelated questions to My questions. The reason for this is that the  questionnaire might change during or after the time that the student works on it. You don’t want the student to be affected by those changes.

2. User profile

  1. In the data item User, add the reference Current questionnaire to User and reference it to Questionnaire.
  2. A user can have only one Current questionnaire. A questionnaire can have more than one user who is currently working on it.
data-item-user
data-item-questionnaire

This way, the user can select the questionnaire he is working on and the teacher can see who is working on a questionnaire.

3. Only show questions that need to be answered

The user flow My current question shows the question that needs to be answered. We need some properties and a flow part to achieve this.

The following properties of My question are used to keep track of answered questions:

- Questionnaire
- Question number
- This question was answered (true/false or date/time)

Design the flow part My current question

flow-part-my-current-question
  1. Start with the input User / Current user.
  2. Find the next question to answer with a look up from My question.
    Questionnaire = Input / User / Current questionnaire AND
    Answered on = Empty AND
    User = Input / User
  3. Generate a single My question, sorted on number, smallest to largest.
  4. The result will be:
    the next question to answer OR
    no question (if all questions are answered), in which case the flow edits the My questionnaire as Completed.
  5. The output will be the question that has to be answered or no question at all.

Design the user flow My current question

In words:

  1. If there is a current questionnaire: get the current question. If not: tell the user that he must select one. Then exit to My questionnaires.
  2. If the flow part My current question returns a question: show the page Answer current question. After the user presses Done, store the answer and look for the next question to be answered.
  3. If no question is returned: this means that the user has answered all questions. Congratulate the user and exit to My questionnaires.