I want to be able to use a lua script to pipe arbitrary arrays into options of a radio button. The closest thing I have found is the setpipevalue function, which only repeats the question. I need to do option piping though. Is there a way to achieve this?
I have never used LUA to set up options for a radio button question. However,we have had to do something similar a couple of times. Our approach was to create an auto-submit page with open textbox questions. The page had a LUA script that assigned values to some of the questions. For other textboxes we used merge codes from previous questions. The radio button question appeared on the following page, and we used merge codes from the text boxes on the admin page to populate the answer options.
This worked well from the respondent’s point of view. We had to do some extra work to get the reporting values of the radio button question to get the response data export into usable shape. We also had to edit the merge codes to get the values that we wanted. Review the SG documentation (https://help.surveygizmo.com/help/merge-codes#question-merge-codes) to understand the difference between an option title and an option value.
I wonder if the hideoption function might be a good starting point:
Since Option Piping essentially shows answer options based on what was selected in a previous question, perhaps you can use a combination of the above function and https://luascript.surveygizmo.com/help#getvalue to mimic option piping.
Hope this helps!
I also would like to know this, did you ever get further with this?