Query A Database

I am trying to query my database. I have created a web service from there I have a list of results. With that list of results I would like to check my existing database to see if the product is there. If not then add, if it is then update with current information from the results of the web service. I have created an iterator stepping through my web service result, how do I then query my database and compare the results. Thanks.
2 answers

Use a temporary table to store the webservice results and run a retrieve query with the proper Xpathconstraint to get a (list) result.

If there is no results returned then create the object, otherwise do the thing you want to do on match and end the end of the compare delete the records from the temp-table

use XML to domain to get the data into a (temporary) table.... actually a work table would be a better description, as the table wont be temporary, but the contents will.

for the comparison you want to Retrieve all records in your Worktable (which will create a "list", then iterate over that list. Inside the "loop" your action would be a "Retrieve" from the product-table, where your Xpath tries to match the identifier from the worktable with one from the products (which works like the SQL you described). Note that you can set the results of the retrieve to "one record only", and the retrieve will give you a matching record (or an empty one).

The next step is a descicion diamond. which should check IF the record you retrieved = Empty

True will then follow the path where you Create a new Product entry (I assume) and False should allow you to do "other things" to the Product you retrieved.


Lex, Thank you for your reply.

I have called the web service and have it creating an XML Stucture, would this be the correct path in creating a temporary table?

Then I have a iterator stepping through those results. A retrieve Products from database. Maybe I am not understanding what this XPath is supposed to be doing. I am able to access the temp table members but not my product members. Would I need access to both in order to compare both. Similar to Select * from products where products.productNumber = results.productNumber...