Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to get particular data from response to use in db?

I wat to parameterize a in db value which is generated in response.. How to do this one?

For example I am creating a customer ID through soap client and I want to check whether that customer ID is inserted into DB or not??

How to do parameterization for above scenario and also I want to write a DB result (out put) in separate file ... Could you please tell me the procedure??

Comments

  • jakubiak
    jakubiak Posts: 795 admin

    You can use a DB Tool to query your database to verify the customer ID was inserted. The DB Tool also allows you to capture the results of the SQL query in XML format - can you save that to file by attaching a Write File Tool to the DB Tool.

  • sunil_subramanian
    sunil_subramanian Posts: 40

    Ya that I tried. I want to parameterize the consumer ID in the SQL query .

    For example select * from xyztable where consumerID = ' generated ConsumerID'..

    In that place of consumer ID the Id should populate automatically, how to paramerize the query for above scenario?

  • Ireneusz Szmigiel
    Ireneusz Szmigiel Posts: 227 ✭✭✭

    Hi sunil_subramanian,

    you have a few examples about parametrization of DB Tool in SOAtest user manual/ help system. See "SQL Query Tab"
    Here is a few examples:
    select * from xyztable where consumerID = '${ generated_ConsumerID_from_Data-Source}'

    or

    select * from xyztable where consumerID = ${<Data Source Name>: <Column Name>}

    note a space between : and <
    or

    select * from xyztable where consumerID = ${<Data Source Column Name mapped to Selected Element>}

  • OmarR
    OmarR Posts: 233 admin

    To add to @Ireneusz Szmigiel comment:
    Please note the ${ var_name } notation that he uses to reference his variable: a dollar sign with the variable's name wrapped in curly braces. This is how the tool will look up the column/variable in the specified datasource during runtime!

  • sunil_subramanian
    sunil_subramanian Posts: 40

    If I'm generating 10 consumer Id's using parameterization, can I get the db results for all 10 consumer Id's at a single run of db tool??

  • OmarR
    OmarR Posts: 233 admin
    edited May 2017

    Yes. Try doing a simple query and let us know if you have any other questions :)

  • sunil_subramanian
    sunil_subramanian Posts: 40

    I have tried below query but in transport layer in request tab its populating as null.

    I have set it as Fixed one and used below query

    Select * from xyztable where consumerId = '${identifier}';

    In that identifier is the tag name where the consumer ID is populate

  • jakubiak
    jakubiak Posts: 795 admin

    It sounds like the variable name that you are using has not been populated with the correct value. Are you using a valid variable name that comes either from a data source, from a data bank variable, or from a test variable?

  • sunil_subramanian
    sunil_subramanian Posts: 40

    I'm using from data bank variable

  • jakubiak
    jakubiak Posts: 795 admin

    So it implies that your data bank did not run, or there was an error running the data bank that caused the variable to not be populated, or the value it is extracted is actually "null".