I have a simple text box grid question and I would like to perform a calculation on two columns and have it populate a third column, similar to a formula in Excel.
For example in the attached image, I’d like to take the GPA * Credit Hours and have it populate Quality Points.
We are trying something similar here. Have 3 textbox questions where respondent will enter a number. We then want to calculate the sum of they’re responses for backend data only. Is there a way to do this or custom script we need to use?
The script would start with the sgapiGetValue function to get the values. This will be a complex step since the text box grid questions stores responses in an array. Fortunately the documentation includes an example of how to extract the values from the array.
The next step would be to convert the values from a string to an integer value. I am not 100% sure that this step is necessary (perhaps another user could chime in), but if it is you can use one of the methods in PHP to make the conversion.
The actual math is probably the easiest part of the script.
Once you have the values calculated you will have to decide how to display them. The easiest method would be to use an %%output statement to place the calculated value on the screen.
Ok, what would that script look like on the next page? The coach could then verify the information.
Unfortunately you can’t do this. The values within the textboxes cannot be read until the respondent hits the NEXT button. Once you get to the next page you could run a custom script. This script would read the textbox grid values, do the necessary math, and then display the resulting value.