In Tibco BusinessWorks Designer, how do one catch “record not found” when using database query?

StackOverflow https://stackoverflow.com/questions/11469510

Question

I'm quite a newbie to Tibco BubinessWorks and sql database, but somehow I have to use Tibco to host a simple web service to query a local database.

What I want to achieve is quite simple, my process in Tibco Designer will have a activity to query the database to find customername with input customerid.

But in the case that no customer was found with specific input customerid, I would like to generate an error. And I've tried to use a "success with condition" to link my database query activity with generate error activity, but I don't know to set the xpath.

The other question is, in the case that no customername of input id is found, does the database return me an null or an empty string?

If it's a null, for the xpath, is there anything like: if(customername = null)?

Thanks!!!

Was it helpful?

Solution

In both cases (ie null or empty string) string-length(customername) = 0 as an XPath expression will work fine to catch the scenario where the customer id has not returned a result. Without knowing your database schema, it's difficult to show any more detail than that.

Note that you can always check the number of rows returned also, for a count of 0.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top