Forum Discussion

lingling_chiang's avatar
lingling_chiang
Contributor
6 years ago

How to pass persistent variable to SQL Query in Keyword Test Data-Driven Loop

How can I  pass the value in Project.Variables.lastAfscId to bus_uid = as show below the SQL Query Text in the keyword test.

 

select subscription_uid from bus_subscription where bus_uid = Project.Variables.lastAfscId

 

 

  • tristaanogre's avatar
    tristaanogre
    6 years ago

    lingling_chiang wrote:

    We have been using the scripts to handle this but just wonder if there is a way to do using the keyword test to specify the variable in the database query.  All the solutions seem pointing to scripting. I guess there seem there is no way to pass the variable to the query text in keyword test.  Am I right to conclude that?


    You are correct.  At this time, you will need to use scripting to run the query.

  • Does that query work for you if you hard code a value for bus_uid instead?

    • lingling_chiang's avatar
      lingling_chiang
      Contributor

      The query works with hard coded bus_uid. I don't know how to pass the variable to the query.

      • Marsha_R's avatar
        Marsha_R
        Moderator

        Okay, I just wanted to make sure that we know the query is good.  Something similar to the code in your first post should work.  What happens when you try the variable?