Summary

This article covers the assign command. 


Description

This command assigns a value to a question.

Attributes

  • none

Parameters

  • one question
  • one value


Note: You cannot assign values to hidden questions. Meaning any question not on the Display tab of the data architect file, or a question that is on the display tab but the Active column is set to “false”.


Example

<script scriptId="bmi-calculation">
    <body>
        <s:if>
            <s:isSet>
                <s:question>
                    <s:list>
                        <s:string value=".weight"/>
                        <s:string value=".height"/>
                        <s:string value=".unit"/>
                    </s:list>
                </s:question>
            </s:isSet>
            <s:if>
                <s:eq>
                    <s:stringPath path=".unit:value"/>
                    <s:string value="US"/>
                </s:eq>
                
                <s:assign>
                    <s:question path=".bmi"/>
                    <s:bmi>
                        <s:weight>
                            <s:numberPath path=".weight:value"/>
                        </s:weight>
                        <s:height>
                            <s:numberPath path=".height:value"/>
                        </s:height>
                        <s:formula>
                            <s:string value="US"/>
                        </s:formula>
                    </s:bmi>
                </s:assign>
                <s:assign>
                    <s:question path=".bmi"/>
                    <s:bmi>
                        <s:weight>
                            <s:numberPath path=".weight:value"/>
                        </s:weight>
                        <s:height>
                            <s:numberPath path=".height:value"/>
                        </s:height>
                        <s:formula>
                            <s:string value="SI"/>
                        </s:formula>
                    </s:bmi>
                </s:assign>
                
            </s:if>
        </s:if>
    </body>
    <target typeId="height" when="preprocess" shouldReconcile='true' />
    <target typeId="weight" when="preprocess" shouldReconcile='true' />
    <target typeId="unit" when="preprocess" shouldReconcile='true' />
</script>

Need more help?

Please visit the Fountayn Contact Information page.