I would like to use own SQL statement in the lookup to restrict output to part of record SELECT emp_number, code FROM `hs_hr_emp_jobtitle_history` WHERE end_date IS NULL;
The output contains 3 different records but Assembly Line returns "Multiple Line Entries" error:
21:39:45,530 INFO - [JDBCConnector_3] CTGDIS495I handleException , lookup, java.lang.Exception: [JDBCConnector_3] CTGDIS048E Multiple entries found and no 'On Multiple Entries' Hook defined. 21:39:45,530 ERROR - [JDBCConnector_3] CTGDIS810E handleException - cannot handle exception , lookup java.lang.Exception: [JDBCConnector_3] CTGDIS048E Multiple entries found and no 'On Multiple Entries' Hook defined. 21:39:45,546 ERROR - CTGDIS266E Error in NextConnectorOperation. Exception occurred: java.lang.Exception: [JDBCConnector_3] CTGDIS048E Multiple entries found and no 'On Multiple Entries' Hook defined. java.lang.Exception: [JDBCConnector_3] CTGDIS048E Multiple entries found and no 'On Multiple Entries' Hook defined. 21:39:45,577 INFO - [FileSystemConnector] CTGDIS525I Closing Parser on output stream.
If I use prepared statement assembly line doesn't recognize possibility to manage this hook
I assume you have put this statement in a lookup connector, correct?
If so then it is normal to get such an error if your link criteria is not bound to a unique constraint, i.e. you are querying for something that can be present in multiple records at the same time. In your case you have 3 records which "end_date" field is NULL. When you get multiple entries returned the AL gives you the opportunity to further filter the records or to put them all in the resultant entry before doing the input map. Since the AL does not know what exactly you might want to be done you have been given the ability to specify your intentions using a hook - "On Multiple Entries" to be precise. In that hook you could cycle throughout all the entries that matched your criteria using a script.
A simpler solution is to use a Connector Loop with your Lookup Connector attached. Then you get the following:
1. Components you drop under this loop are cycled through, once for each entry found by your Lookup Connector.
2. You get a Connector Parameters Map tab where you can map in the SQL you want to use. This makes it easy to use JavaScript or Expression mapping to compute this SQL string using values in Work Attributes or script variables.
And if you are using a Loop and setting the SQL SELECT yourself, I would use Iterator mode instead of Lookup. These two modes are almost identical, apart from a couple of major differences:
a1). Iterator mode leaves the result set on the server, returning a single entry with its getNextEntry() call for each cycle. b1). Lookup mode fetches the result set in memory. To prevent memory problems, this is limited to max 10 entries & configured in the AssemblyLine Settings tab -- called "Config" in TDI 6, and behind the AssemblyLine's "Options" button in TDI 7. This can be set at the individual Connector level in TDI 7 through the "More" button to the right of the Inherit From Parent button.
a2). Iterator mode uses Config parameters to perform its search. b2). Lookup mode uses Link Criteria. The advantage here is that the search is done during AL cycling, while Iterator mode does this at initialization. However, since the Loop lets you map in the Config parameters and set the Initialization option to only Select, you get the same flexibility for Iterator mode.
3. You can step through this in the Debugger!!! (you knew I had to mention the Debugger as well :)
-Eddie
On Jul 2, 10:38 am, "kolev.kg" <kolev...@gmail.com> wrote:
> I assume you have put this statement in a lookup connector, correct?
> If so then it is normal to get such an error if your link criteria is > not bound to a unique constraint, i.e. you are querying for something > that can be present in multiple records at the same time. In your case > you have 3 records which "end_date" field is NULL. When you get > multiple entries returned the AL gives you the opportunity to further > filter the records or to put them all in the resultant entry before > doing the input map. Since the AL does not know what exactly you might > want to be done you have been given the ability to specify your > intentions using a hook - "On Multiple Entries" to be precise. In that > hook you could cycle throughout all the entries that matched your > criteria using a script.
> I assume you have put this statement in a lookup connector, correct?
> If so then it is normal to get such an error if your link criteria is > not bound to a unique constraint, i.e. you are querying for something > that can be present in multiple records at the same time. In your case > you have 3 records which "end_date" field is NULL. When you get > multiple entries returned the AL gives you the opportunity to further > filter the records or to put them all in the resultant entry before > doing the input map. Since the AL does not know what exactly you might > want to be done you have been given the ability to specify your > intentions using a hook - "On Multiple Entries" to be precise. In that > hook you could cycle throughout all the entries that matched your > criteria using a script.
> Best Regards, > Kaloyan Kolev.
I am doing this query on the table with 3 records. Each of them is unique. How I described the prepared statement doesn't invoke "on multiple entries" hook. Why this same assembly line did discover necessity to use multiple entries hook (with my SQL instruction) and the second time it didn't it (use prepared statement)?? What does exactly TDI 7.0 do?
Hi, The mentioned documentation says: "A few Hooks are mandatory and must be enabled, although they do not need to actually contain any script. If a mandatory Hook is not enabled and the flow reaches this point, then this is considered an error, and control faults out to error handling."
Great but my table contains only three records!!! If I use Prepared Statement the "on multiple entries" hook is not invoked!!!!!
My SQL statement returns unique records also. I assume that prepared statement is similar to SELECT * from <TABLE> I added additional condition which narrows output "WHERE blabla IS NULL"
It shows that Hook is managed different way when we use Prepared Statement or not!!! When can I find description???
> I assume you have put this statement in a lookup connector, correct?
> If so then it is normal to get such an error if your link criteria is > not bound to a unique constraint, i.e. you are querying for something > that can be present in multiple records at the same time. In your case > you have 3 records which "end_date" field is NULL. When you get > multiple entries returned the AL gives you the opportunity to further > filter the records or to put them all in the resultant entry before > doing the input map. Since the AL does not know what exactly you might > want to be done you have been given the ability to specify your > intentions using a hook - "On Multiple Entries" to be precise. In that > hook you could cycle throughout all the entries that matched your > criteria using a script.
> Best Regards, > Kaloyan Kolev.
Hi, Maybe my problem is related with my misunderstanding how the query in the JDBC connector should be defined.
I assumed standard query: for example Select * from <table>. Probably I should use the sql with parameter which refers to particular input record from iteration connector. Could you tell me how the syntax of sql statement looks like?
For example Select * from table where <filed>=$parameter I can't find this information
> On 2 Lip, 10:38, "kolev.kg" <kolev...@gmail.com> wrote:
> > I assume you have put this statement in a lookup connector, correct?
> > If so then it is normal to get such an error if your link criteria is > > not bound to a unique constraint, i.e. you are querying for something > > that can be present in multiple records at the same time. In your case > > you have 3 records which "end_date" field is NULL. When you get > > multiple entries returned the AL gives you the opportunity to further > > filter the records or to put them all in the resultant entry before > > doing the input map. Since the AL does not know what exactly you might > > want to be done you have been given the ability to specify your > > intentions using a hook - "On Multiple Entries" to be precise. In that > > hook you could cycle throughout all the entries that matched your > > criteria using a script.
> > Best Regards, > > Kaloyan Kolev.
> Hi, > Maybe my problem is related with my misunderstanding how the query in > the JDBC connector should be defined.
> I assumed standard query: for example Select * from <table>. > Probably I should use the sql with parameter which refers to > particular input record from iteration connector. > Could you tell me how the syntax of sql statement looks like?
> For example Select * from table where <filed>=$parameter > I can't find this information
BTW The filter is defined in the link criteria and I don't need put it in the sql statement