Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Dynamic table + Unverified Perl

Dear All,

Im trying to build a dynamic table to show winning concepts of the ACBC study. There are fixed and dynamic (pre-selected) attributes. I would like to  show only these attributes which were truly evaluated. Unfortunatelly my table doesn't  work.
Study name is : PACS. Pre-selected can be only 1 attribute.

 
 
<table border="1" cellpadding="8" cellspacing="0" width="80%" style="font-size:13px;   font-family: Arial; color: #000000;">

<tr>
  <td>  Attribute 1 </td>
  <td> [%ACBCWinnerLabel(PACS, 1)%] </td>
</tr>
<tr>
  <td>   Attribute 2 </td>
  <td> [%ACBCWinnerLabel(PACS, 2)%] </td>
</tr>
...
etc.
[% Begin Unverified Perl  

# Attribute 8
 my $SysAva=ACBCWinnerLabel("PACS", 8);
if(LISTHASPARENTMEMBER("AttributesSelected",8)==1)
 
 {return "<tr>
  <td>  Attribute 8 name</td>
  <td> $SysAva </td>
</tr>" ;} 

# Attribute 9
 my $Perf=ACBCWinnerLabel("PACS", 9);
if(LISTHASPARENTMEMBER("AttributesSelected",9)==1)
 
 {return "<tr>
  <td>   Attribute 9 name </td>
  <td> $Perf </td>
</tr>" ;} 

End Unverified%]

 



Can someone help?
Thank you!
robson
asked Apr 23 by robson Bronze (700 points)
Could you catch me up on what you mean by fixed and dynamic attributes?  What defines a "truly evaluated" attribute?

What incorrect behavior are you observing with your current code?  Are errors appearing in your admin module when the code runs?
Hi Zachary!

12 attributes are split onto 2 groups :
a) 8 always appear for respondents - fixed ones
b) out of remaining 4 attributes respondents select one best  - these 4 attributes I call 'dynamic'.

One pre-selected attribute b) is then piped into ACBC via Constructed list. At the end of the study I want to show them a table with the winning attributes and levels.
So the table should show 8 fixed attributes and 1 attribute from the group b).  *My code above contains just 2 dynamic attributes as I wanted to test the solution with a lower number of code lines.

Here is the error log I got :

"There is an error in SSI Web Scripting: Script:
# Attribute 8
 my $SysAva=ACBCWinnerLabel("PACS", 8);
if(LISTHASPARENTMEMBER("AttributesSelected",8)==1)
  
 {return "<tr>
  <td>  Attribute 8 name</td>
  <td> $SysAva </td>
</tr>" ;}
 
# Attribute 9
 my $Perf=ACBCWinnerLabel("PACS", 9);
if(LISTHASPARENTMEMBER("AttributesSelected",9)==1)
  
 {return "<tr>
  <td>   Attribute 9 name </td>
  <td> $Perf </td>
</tr>" ;}
  | Server Error: Undefined subroutine &authlib7_0_30::ACBCWinnerLabel called at (eval 103) line 3, <GEN1> line 18.  |  params= hid_pagenum=>50, hid_backup=>ENPACTEST,1,431271,43,1, hid_prev_PACS_ChoiceTask4=>21,PACS_ChoiceTask4,43,9a03b4d23e0b623015d0dbcfaf58ebc9, hid_respnum=>1, hid_q_PACS_ChoiceTask4=>PACS_ChoiceTask4, hid_checksum=>431271, hid_previous=>0, hid_pagetime=>10998, hid_studyname=>ENPACTEST, PACS_ChoiceTask4=>27,39,38, hid_test_mode_settings=>,0,0,0,0,0,0,1, hid_javascript=>1,  IP= 127.0.0.1 ,  client= Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0"
Thanks for the explanation.

That error is triggered because the Perl doesn't recognize ACBCWinnerLabel as a subroutine.  Remember that, while normal Sawtooth Script is case-insensitive, Sawtooth Script functions that appear in unverified Perl need to be written in all caps.

ACBCWINNERLABEL
Now it  works!
Thank you very much Zachary!

Your solution to the original question

Please only use this to answer the original question. Otherwise please use comments.
Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:

To avoid this verification in future, please log in or register.
...