Summary
I am collecting survey results - one for a pre-test and one for a post-test and I am looking for a way to automatically generate a calculation on a numerical field in two nodes (one pre-test, one post-test) and store that calculation.
For example in a content type "Survey Result", I have the following two nodes:
Node A:
- field_participant_id: 111
- field_pre_or_post: pre
- field_mean: .5
Node B:
- field_participant_id: 111
- field_pre_or_post: post
- field_mean: .75
I am hoping to be able to be able to automate a way to calculate the difference between field_mean in the two nodes (.25) when a post-test comes through and be able to store that calculated value.
More Details
Below is some additional context in case it is helpful, or there is an easier way to do what I am trying to do.
- Data comes in using Webform filled out two times by a participant on a pre and post survey. The goal is to have the calculation run when the post survey is submitted.
- Each webform results is converted to a Survey Result content type using Webform Content Creator module that includes fields with: participant id, pre or post test and the mean score from the survey.
- Once a post survey is created, I am hoping to trigger a calculation the difference in those scores and store that calculation either in Node B or a new node/content bundle. Then I hope to use that calculated number in some views.
Any ideas on how something like this may be possible - preferably using a contribu module?