You are not logged in.
I'm creating a tRESTRequest-based job for looking up customer records in a db.
Job consists of 4 components:
tRESTRequest provides a lookup variable to tXMLMap (example, 'id' of type Integer), tXMLMap delegates to a DB component to do a lookup which usually returns 2 fields, ex, 'id' and 'name' and then tXMLMap uses the returned fields to create an xml payload which is fed into tRESTResponse.
See the attached images please.
However, if no a given customer exists, I'm getting
I'd like to configure tXMLMap somehow to react to the fact that no a customer with id like '6' exists and return some different xml response.
Can I handle it somehow in tXMLMap alone or should I use the DB components triggers somehow ?
Last edited by sberyozkin (2011-11-29 13:47:48)
Prior to the tXMLMap, you can use a tMap and tFilterRow to establish a reject output. Left outer join the lookup to the DB customers, passing along the db's id which will be null if the lookup fails. tFilterRow records with a db id. The filter connection goes on to tXMLMap while the reject connection goes to a second tXMLMap which produces XML specific to the reject handling.
The reject handling could be a separate XML document. Or, you can use 2 tAdvancedFileOutputXMLs in append mode instead of the tXMLMap. See the section "Multiple Loops" in the blog post http://bekwam.blogspot.com/2011/09/xml- … urces.html for how to do thi.
Sorry for a delay, I did not get a notification the response was available.
Can you clarify please how to use tFilterRow ? I've uploaded two more images, tFilterRow1.png and tFilterRow2.png.
tFilterRow1.png shows a tFilterRow being inserted between tRESTRequest and tXMLMap, with Customers (DB) acting as a lookup. Note that 'id' which is coming from tRESTRequest is never null or empty, so the tFilterRow/Reject is never activated, if no record exist I simply get an empty customer XML back,
tFilterRow2.png shows a tFilterRow being inserted between Customers and tXMLMap, in the actual job it has a 'NAME NotEqualTo ""' rule (CUSTOMERS return ID & NAME).
When I have an existing record being retrieved, tFilterRow directs it to the main output which is fine, and if I request a customer with a non-existent id, the job hangs and the tFilterRow rejects output is not activated.
Sorry if I'm missing something
I haven't used tRESTRequest and tRESTResponse, but here's a screenshot of a job that filters after a left outer join in the tMap.