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 validate and insert the data to DB table using virtual asset

Options
mdsheeraz
mdsheeraz Posts: 9

We are looking to create Parasoft API to insert the data to the tables by passing the parameters. UI should be able to invoke the API

/insertMeterNum

Step 1 to check if the data for example ( meter number ) is already exists in the table and respond back with " Meter number is already exists "
Step 2 to Insert the data in to the table if sending data ( meter number is not available in the table )

And,
/UpdateMeterNum
To update the new sending data to the existing specific meter number

Could you please help on the above request.

Answers

  • williammccusker
    williammccusker Posts: 645 ✭✭✭
    Options

    Hi,

    For the first step perhaps a Database Datasource and a data source correlation could be used to have the first responder return the "already exists" message. Then if that correlation fails a second responder could be configured with a Database Tool to perform the insertion.

    Here is a link to some documentation on setting up correlations
    https://docs.parasoft.com/display/SVC20231/Customizing+Request+Matching+and+Correlations

    Hope this helps.

  • mdsheeraz
    mdsheeraz Posts: 9
    Options

    Hello,

    Thanks for the steps.

    Just wanted to know is there anyway to achieve the requirement using scripting using extension tool?

  • williammccusker
    williammccusker Posts: 645 ✭✭✭
    Options

    Hi,

    It's possible, but making the database connection in the scripts would be more work than using the existing Database Data Source and Database Tool which manage all that for you. It would also probably be a bit more work to do the check for the existing in a script. I would recommend trying to use the builtin tools first.

  • mdsheeraz
    mdsheeraz Posts: 9
    Options

    Ok, thanks for your inputs, will give it a try.