Completed

How do we accomplish IF a substring is contained within a larger string

We have a need to use CONTAINS in the IF command.

For example:

IF ("KJAX RWY 04/28 CLSD FOR DELTA TESTING" Contains "DELTA TESTING") {

do something

}ELSE{

do something else

}

There seems to not be away to accomplish this with the current IF command.

How would I accomplish conditional branching with Contains?

0
4 comments
Avatar
Joseph Hamdan

Hi Dominic,

To get a better picture of this scenario, could you please check the questions below:

1- Where are you taking the initial value from? Using which command?

2- Are you using an XPath to retrieve this value? Could you please provide the XPath?

3- Does this condition need to perform a certain operation on the same page where the initial value is found or on a different page?

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

1.) In this particular case I am using GET_REST_VALUE and storing the JSON key/value into a variable.  Note this is not the only application.  I also have the same issue with using GET_WEB_VALUE

2.) I am grabbing the value from the JSON_BODY

3.) Does not apply in this scenario (there is no page) but in the case of using GET_WEB_VALUE, it could be on the same page or different page.

In the IF command when you chose the comparison type of TEXT, I am not sure why the OPERATORS selection drop-down are the same as for comparing numbers (ex. EQUAL, GREATER THAN, LESS THAN, etc).  Typically for string/text you do not use the same operators as for numbers.  I would expect operators like EQUALS, NOT EQUALS, CONTAINS, NOT CONTAINS, etc.

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Dominic,

We have added the following new features in 8.17.4 which should help you accomplish the requested scenarios. Here are the release notes for them:

  • Added new operators to IF command that can help users with various operations:
    • Contains: Checks if the left value contains a particular text in the right value
    • Starts-with: Checks if the left value starts with a particular text in the right value
    • Ends-with: Checks if the left value ends with a particular text in the right value
  • Added the ability for IF command to store variables with a Boolean value of true or false
  • Added the ability for Contains command to store variables with a Boolean value of true or false

Regards,

Subject7 Team

0
Comment actions Permalink
Avatar
Dominic Luminello

Hi Joseph,

 

This is great!  Thank you so much.  I will upgrade and give it a try.

0
Comment actions Permalink

Please sign in to leave a comment.