Hi all,

I have a question about the duplication of a questionnaire. I have multiple questionnaires with a lot of questions. The questionnaire is stored in a table called questionnaire. The questiontypes, answers etc are all stored in separate tables. 

I can add these questionnaires to specific assignments and answer the questions for that assignment. Now I also want to have to possibility to add the same questionnaire multiple times without overwriting the one that already exists. 

So for instance let's say I have a questionnaire that is called Personal Situation. I have multiple people in a group and I want them to answer the questionnaire. Because of regulatory reasons some of them have to this every quarter. Not all, but some. So what I want to happen is that when someone selects the same questionnaire again, it gets duplicated (With the previous answers if possible) but get's it own record and ID making it unique. Now I also want to change the name dynamically based on the quarter that it is filled out in. 

Does anyone know how to do this? 


Hi Max,

I do not know exactly all of the specifications of your requirement but it seems that you just need a way to duplicate the record, and you will work out the rest of the implementation for yourself.

What you can do, is that when the user presses a button next to the questionnaire (let's call it "Redo Questionnaire"), then you will go to a questionnaire screen and find the last questionnaire of that type that the user filled in with the help of an aggregate. You can find this by a specific ID, questionnaire type ID or just by ordering by ID descending. You'll send whatever parameter you want to use as an input to this questionnaire screen.

Then on the preparation of the screen you will assign your questionnaire record variable to the one that you fetched. Just change the ID field to NullIdentifier(), change the Quarter field to the current one and you're basically good to go.  Bind the questionnaire record variable to the form that needs to be completed and use this variable as the source record for creating or updating the database record.

Whenever the user saves the questionnaire, just do a CreateQuestionnaire or a CreateOrUpdateQuestionnaire database action and because the ID is now null, it will create a new record.

Hope this helps

Regards
Dylan