Forum Discussion

bhakti's avatar
bhakti
Contributor
10 years ago

How to apply if contains condition for two variables in Keyword test

In keyword test, i have defined two variables (say A &B)

Test is passed if  variable  A ( value store in variable A is "203,pedning,22/3/45") contains variable B (value store in variable B is  203)  

 Please guide me , which  statement is useful here (if..Then, return, checkpoint  etc) 

 

 

  • I think I've solved your problem.

     

    It looks like your Value2 is not set to;

     

    Mode - Constant

    Type - Integer

    Value - 0

     

    Try it all again with your actual data and this setup for Value2 and it should work. Also make sure the Condition is set to "Greater Than or Equal To"

     

    Rich

  • richardw_1's avatar
    richardw_1
    Occasional Contributor

    Hi Bhakti,

     

    I'm no coding expert by any means! But I thought I'd give it a try to see if what I have learned so far might be able to help you.

     

    I think I understand your question. I've only been using JScript so the way I would do this is.

     

    var A = "203,pending,22/3/45";
    var B = 203;

    if (aqString.Find(A,B,0) = 0)
    {
        return true;
    }

    else
    {
        return false;
    }

     

    My understanding is that if the "Find" method finds the substring in the input string then it returns with a result of '0' else it will return a result of '-1'.

     

    Let me know how this works for you.

     

    Rich

    • bhakti's avatar
      bhakti
      Contributor

      Hi,

       

      thanks for replay :-)

       

      Actually i am not working on Scripting/coding 

      I am working on keyword test

       

      in keyword test what should i use to get expected as mentioned in the query.

       

      • richardw_1's avatar
        richardw_1
        Occasional Contributor

        Ahh, sorry. Missed that part.

         

        See attached image.

         

        Basically you need to select 'Code Expression' for the Mode of Value1 and then essentially put in the same bit of code.

         

        aqString.Find(A,B,0)

         

        then in the value2 field you want it to equal 0.

         

        Does this help?

         

        Rich