Page 1 of 1

creating a record only when it is not in the database using create service and query service of the database

Posted: Mon Nov 25, 2013 3:28 am
by chansdad

how to creating record only if the record does not exist . What is the best approach ? I have a db , and using the create service to create the record - this works .
I have been trying to use database query service to query for the record and then call the create service only if the query returned has no records.
db query service always returns a success , just that the rows returned is empty or zero so cannot really use this for creating a record only when record does not exist .
Any suggestions? or perhaps an example would be helpful on how to use db create service to create a record only when a record does not exist .

Thanks


creating a record only when it is not in the database using create service and query service of the database

Posted: Mon Nov 25, 2013 4:08 am
by maxkatz

You got the right approach. Check first if particular object exists. If no, the do a request that will create it.


creating a record only when it is not in the database using create service and query service of the database

Posted: Mon Nov 25, 2013 4:25 am
by chansdad

never mind , was able to get it to work .. I guess I have to get used to the appery style of wiring the logic.