Saving Dynamic data

I have run into the following problem several times and have an ok workaround, but not great one.

What I am trying to do. I want to have each user of my system create a custom survey - so they can create questions custom to them. I do this by having something like this:

user - link to users
question - text

I can easily then modify/add/edit the questions per user and then display the questions for just one user by doing a repeating group and searching for all questions for the logged in user.

The issue comes when I want them to rate themselves against the questions. I have created a table

user - link to user
question - link to question table above
answer - the answer (in my need 1 to 10)

I can build the form easily - having a drop down in the repeating group. The repeating group queries questions where user is user. So each row has the question text and then a dropdown with 1 to 10. What I would like to do is have a submit button outside the repeating group and loop through each item in the repeating group when that is hit and save the dropdown value into the reponses table. However, I can’t figure out how to do this.

I have found a work around sort of. I can have each dropdown trigger an action on change and save the value in the responses table when they are changed. This sort of works, however there are two problems with that: 1) I can’t force all fields to be completed and 2) If you change your selection two or more times each change gets saved in the DB. I could probably work around these two issues, but it feels like there should be a more elegant and simple way to solve this by just looping through items in a repeating group when you press a button.

Thanks for any help.

1 Like

working with repeating groups and extracting data using elements outside of the repeating group gets tricky.

The best thing that I have come across, and which should work for you, is the BDK “env” variables plugin.

Basically it gets placed into the repeating group and onto the page. You can use it to store data, change data and also trigger workflow events when the data changes.

So in your use case, you’d have the dropdown value change the “env” variables value, which would trigger the workflow event to save the value to the D.B.

Check out that plugin, its $16 and well worth it. When I first purchased I was a bit upset I did because I only used it once, but as I progressed with my app, I have since used it countless times and it has become invaluable to me.

This topic was automatically closed after 70 days. New replies are no longer allowed.