Summary

This command accepts two strings and returns ‘true’ if the first string contains the second string. 


This command can be used for all question types. However, for multi-value questions the contains command should be used when the goal is to compare a string to the exact value of each selected answer.

Attributes

  • none

Parameters

  • one string command
  • one string command

Example

<script scriptId="setAlertComment">
  <body>
    <s:alert>
      <s:expression>
        <s:not>
          <s:isSet>
            <s:question>
              <s:question path="/scriptContainer/createPregnancy[n].pregComment" type="question"/>
            </s:question>
          </s:isSet>
        </s:not>
      </s:expression>
      <s:correction>
        <s:string value="optional"/>
      </s:correction>
      <s:text>
        <s:if>
          <s:stringContains>
            <s:stringPath path="/scriptContainer/createPregnancy[n].pregComment:value" type="string"/>
            <s:string value="bc1"/>
          </s:stringContains>
          <s:string value="Answer 1"/>
          <s:if>
            <s:stringContains>
              <s:stringPath path="/scriptContainer/createPregnancy[n].pregComment:value" type="string"/>
              <s:string value="bc2"/>
            </s:stringContains>
            <s:string value="Answer 2"/>
            <s:if>
              <s:stringContains>
                <s:stringPath path="/scriptContainer/createPregnancy[n].pregComment:value" type="string"/>
                <s:string value="bc3"/>
              </s:stringContains>
              <s:string value="Answer 3"/>
            </s:if>
          </s:if>
        </s:if>
      </s:text>
    </s:alert>
  </body>
  <target action="update" typeId="pregComment" when="preprocess" shouldReconcile='true'/>
</script>
NoteThe full path, /scriptContainer/createPregnancy[n].pregComment, can also be written as .pregComment.




Need more help?

Please visit the Fountayn Contact Information page.