How can I compareValues for a range on two string parameters?

Comments

1 comment

  • Avatar
    wojciechka

    By default multiple rules are evaluated so that the action is run when all actions are true. You can change it by adding <ruleEvaluationLogic>or</ruleEvaluationLogic>. For your example it would be:

                  <parameterList>
                    <stringParameter>
                      <name>server_port</name>
                      <description>Port</description>
                      <default>6666</default>
                      <allowEmptyValue>0</allowEmptyValue>
                      <width>20</width>
                      <validationActionList>
                        <showWarning>
                          <text>Cannot bind to port ${server_port}.</text>
                          <ruleList>
                            <portTest condition="cannot_bind" port="${server_port}" />
                          </ruleList>
                        </showWarning>
                      </validationActionList>
                    </stringParameter>
                    <stringParameter>
                      <name>server_threads</name>
                      <description>Number of Threads</description>
                      <default>${machine_cpu_count}</default>
                      <allowEmptyValue>0</allowEmptyValue>
                      <width>10</width>
                      <validationActionList>
                        <showWarning>
                          <text>Invalid thread option.  The number of threads must be greater than 0 and less than ${server_threads_max}.</text>
                          <ruleEvaluationLogic>or</ruleEvaluationLogic>
                          <ruleList>
                              <compareValues>
                                <logic>greater</logic>
                                <value1>${server_threads)</value1>
                                <value2>${server_threads_max}</value2>
                              </compareValues>
                              <compareValues>
                                <logic>less_or_equal</logic>
                                <value1>${server_threads}</value1>
                                <value2>0</value2>
                              </compareValues>                      
                          </ruleList>
                        </showWarning>                        
                      </validationActionList>
                    </stringParameter>
                  </parameterList>
    

Please sign in to leave a comment.