Setting a field name in a Variable / Case Statement

Discussion created by themactech on Nov 20, 2015
Latest reply on Nov 20, 2015 by themactech

I'm wondering what I'm doing wrong with this. I have a container field with 5 repetitions for a small document repository.


I created a preview button that when the user clicks it brings up the document out of the container field. When I create a script and actually hand code the field name in certain parts of the script /calculations it works but I want to get better a making my scripts more efficient. So I decided to try to use variables.


When the user clicks the preview button it has a script parameter and based on that I would like to set another variable with the appropriate field name in it. If can get this figured out I'm the rest of the script will work.


I set a variable called $sp = Get(ScriptParameter)


then I create another variable called $field which has the calculation below


Case (












But the variable ends up empty. I can see in the DataViewer that the $sp variable is working. And if I put a text value "test" instead of the field name then that shows up in the $field variable.


Any suggestions as to what I'm missing would be greatly appreciated.