You are not logged in.
Announcement
Unanswered posts
|
Thanks a mill, adding an extra tMAP made it work, see the attached image.
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.
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
Hi Carl,
Nice blog post, thanks!
Best,
Pcoffre.
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.
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.
For example,
GET http://localhost:8088/customer/1
will return
<customer><name>Fred</name></customer>.
However, if no a given customer exists, I'm getting
<customer><name/></customer>
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 ?
thanks, Sergey