Options

checkbox

The checkbox variable holds the state information for the check box option. If the check box is selected, the variable is set to 1. If the check box is not selected, the variable is set to 0.
In this example, the code outputs the character N if the Print row numbers check box is selected.
<Options>
   <Option name="PRINTNUMROWS" defaultValue="1" 
      inputType="checkbox">Print row numbers</Option>
</Options>
<Code Template>
   <![CDATA[
#if ($PRINTNUMROWS == '1')
      N
#end]]>
</CodeTemplate>

color

The color variable holds the specified color.
In this example, the code template is printed as colorEXAMPLE=specified-color.
<Options>
   <Option name="colorEXAMPLE" defaultValue="white" 
      inputType="color">Select a color</Option>
</Options>
<CodeTemplate>
   <![CDATA[
%put colorEXAMPLE=$colorEXAMPLE;
#end]]>
</CodeTemplate>

combobox

The combobox variable holds the name of the selected option. If no option is selected, the variable is null.
This example outputs the string HEADING=option-name, where option-name is the value selected from the Direction of heading drop-down list. If the user selects Horizontal from the Direction of heading drop-down list, the output is HEADING=”horizontal”.
<Options>
   <Option name="HEADING" defaultValue="default"
      inputType="combobox">Direction of heading:</Option>
   <Option name="default" inputType="string">Default</Option>
   <Option name="horizontal" inputType="string">Horizontal</Option>
   <Option name="vertical" inputType="string">Vertical</Option>
</Options>
<UI>
   <Container option="OPTIONSTAB">
      <OptionChoice option="HEADING">
         <OptionItem option="default"/>
         <OptionItem option="horizontal"/>
         <OptionItem option="vertical"/>
      </OptionChoice>
   </Container>
</UI>
<CodeTemplate>
   <![CDATA[
#if ($HEADING && (&HEADING !="default"))
      HEADING=$HEADING
#end
]]>
</CodeTemplate>

inputtext

The inputtext variable holds the string that was specified in the text box.
This example outputs the string OBS= and the text specified in the Column text box. If the user enters Student Number into the Column text box, the output is OBS=”Student Number”.
<Options>
   <Option name="OBSHEADING" indent="1" defaultValue="Row number"
      inputType="inputtext">Column label:</Option>
 </Options>
<CodeTemplate>
   <![CDATA[
OBS="$OBSHEADING"#end]]>
</CodeTemplate>

numstepper

The numstepper variable holds the string specified in the number control box.
This example outputs the string GROUPS= and the value in the Number of groups box. If the user enters 2 into the Number of groups text box, the string output is GROUPS=”2”.
<Options>
   <Option name="NUMGRPS" defaultValue="1" minValue="0" 
      inputType="numstepper" indent="1">Number of groups:</Option>
 </Options>
<CodeTemplate>
   <![CDATA[
GROUPS="$NUMGRPS"#end]]>
</CodeTemplate>

radio

The radio button options are grouped together with the same variable attribute. It is this attribute that defines the Velocity scripting variable. The Velocity scripting variable holds the name of the selected radio button. If no radio button is selected, the variable is null.
In this example, there are four radio buttons.
  • If the first radio button is selected, there is no output.
  • If the second radio button is selected, the string output is GROUPS=”100”.
  • If the third radio button is selected, the string output is GROUPS=”10”.
  • If the fourth radio button is selected, the string output is GROUPS=”4”.
<Options>
   <Option name="RMSL" inputType="radio" variable="RMGRP" 
      defaultValue="1">Smallest to largest</Option>
   <Option name="RMPR" inputType="radio" 
      variable="RMGRP">Percentile ranks</Option>
   <Option name="RMDC" inputType="radio" variable="RMGRP">Deciles</Option>
   <Option name="RMQR" inputType="radio" variable="RMGRP">Quartiles</Option>
 </Options>
<CodeTemplate>
   <![CDATA[
#if ($RMGRP.equalsIgnoreCase("RMPR")) GROUP=100 #end
#if ($RMGRP.equalsIgnoreCase("RMDC")) GROUP=10 #end
#if ($RMGRP.equalsIgnoreCase("RMQR")) GROUP=4 #end
]]>
</CodeTemplate>

slider

The slider variable holds the numeric string that is specified on the slider control.
This example outputs the string datalabelattrs=(size=”n), where n is the value of the Label Font Size option. If the value of the Label Font Size option is 10, the output is datalabelattrs=(size=10).
<Options>
   <Option name="labelSIZE" defaultValue="7" inputType="slider"
      discreteValues="16" minValue="5" maxValue="20">Label Font Size</Option>
 </Options>
<CodeTemplate>
   <![CDATA[
datalabelattrs=(size=$labelSIZE]]>
</CodeTemplate>

validationtext

The validationtext variable holds the string that was specified in the text box.
The following example outputs the string OBS= and the text specified in the Column text box. If the user enters Student Number into the Column text box, the output is OBS=”Student Number”.
<Options>
The inputtext variable holds the string entered into the text field.

The following example outputs the string "rho0=" and the text in 
the Null hypothesis correlation option. If the user specifies 0,
the string rho0=0  is generated. 
<source lang="xml">
<Options>
   <Option name="nullRho" indent="1" inputType="validationtext" 
      defaultValue="0" required="true"
      promptMessage="Enter a number greater than -1 and less than 1
         for the null hypothesis correlation"
      invalidMessage="Enter a number greater than -1 and less than 1
         for the null hypothesis correlation"
      missingMessage="Enter a number grearter than -1 and less than 1
         for the null hypothesis correlation"
      regExp="[-+]?((0\.\d*)|(\.\d+)|0)">Null hypothesis correlation:</Option>
 </Options>
<CodeTemplate>
   <![CDATA[
rho0=$nullRho]]>
</CodeTemplate>

string

This input type cannot be accessed within the Velocity script.

modelbuilder

The Model Effects Builder is a custom component. This example code shows how the Model Effects Builder might be used in the user interface for a task. The Velocity code shows how to process the effects that are generated by the modelbuilder component.
<Metadata>
   <DataSources>
      <DataSource name="dataset">
      <Roles>
      <Role type="N" maxVars="0" minVar="1" order="true"
         name="CONTVARS">Continuous variables</Role>
      <Role type="A" maxVars="0" minVar="0" order="true"
         name="CLASSVARS">Classification variables</Role>
   </Roles>

   <Options>
      <Option inputType="string" name="modelGroup">MODEL</Option>
      <Option inputType="string" name="modelTab">MODEL</Option>
         <Option excludeTools="THREEFACT, NFACTPOLY" inputType="modelbuilder"
            name="modelBuilder roleClassification="classVariables"
            roleContinuous="continuousVariables" width="100%">Model</Option>
      <Option inputType="string" name="responseGroup">Response</Option>
    </Options>
</Metadata>
<UI>
   <Container>
      <Container option="modelTab">
         <Group open="true" option="modelGroup">
            <OptionItem option="modelBuilder"/>
         </Group>
      <Container>
</UI>

<CodeTemplate>
<![CDATA[

#macro ( ModelEffects )
#if ( $modelBuilder )
#foreach ( $item in $modelBuilder )
## if first element is 'm', then this is a main effect
#if ( $item.get(0) == 'm' )
#foreach( $subitem in $item.get(1) )$subitem #end
## if first element is 'i', then this is an interaction effect
#elseif ( $itemget(0) == 'i' )
#foreach( $subitem in $item.get(1) )$subitem#if($velocityCount
   < $item.get(1).size())*#else #end#end
## if first element is 'n', then this is a nested effect
#elseif ( $item.get(0) == 'n' )
#foreach( $subitem1 in $item.get(1) )$subitem1#if($velocityCount
   < $item.get(1).size())*#end#end(#foreach($subitem2 in 
   $item.get(2))$subitem(2)#if($velocityCount < 
   $item.get(2).size())*#end#end)
#end
#end
#end
#end



]]>
</CodeTemplate>