Discussion:
Multiple FOR-EACH Loop
Add Reply
t***@gmail.com
2017-10-03 14:48:01 UTC
Reply
Permalink
Raw Message
Hi

I have two Loops, the first one (JDBC) gets values to be used as parameters in the second Loop (LDAP Connector), however after the first iteration of one of the values obtained in the first cycle, the AL simply stops. How ca i force the second Loop go back to first Loop.

FOR-EACH - JDBC
Get Values for ldapSearchBase
FOR-EACH - LDAP
Change ldapSearchBase


Thnks in Advance
Tiago
rp
2017-10-04 00:21:58 UTC
Reply
Permalink
Raw Message
Is your jdbc connector returing more than 1 record ? I would check to see if the SQL is correct and returns the numbrr of rows you are expecting .

Also you can add your jdbc to the feeds section in iterator mode and for each entry returned do a ldap lookup in the flows section.its possible your jdbcisnt in the right mode. Lookup mode by default only returns 10 entries iirc.
Tiago Feitor
2017-10-04 08:48:55 UTC
Reply
Permalink
Raw Message
Post by rp
Is your jdbc connector returing more than 1 record ? I would check to see if the SQL is correct and returns the numbrr of rows you are expecting .
Also you can add your jdbc to the feeds section in iterator mode and for each entry returned do a ldap lookup in the flows section.its possible your jdbcisnt in the right mode. Lookup mode by default only returns 10 entries iirc.
Hi

My SQL has more than one value, when I disable the FOR-EACH - LDAP, the first Loop works fine.
Eddie Hartman
2017-10-04 09:16:08 UTC
Reply
Permalink
Raw Message
Post by rp
Is your jdbc connector returing more than 1 record ? I would check to see if the SQL is correct and returns the numbrr of rows you are expecting .
Also you can add your jdbc to the feeds section in iterator mode and for each entry returned do a ldap lookup in the flows section.its possible your jdbcisnt in the right mode. Lookup mode by default only returns 10 entries iirc.
Looping should continue as long as data is returned, so as RP notes you should check your query. And easy test would be to disable the inner Loop and add a dumpEntry script to see how much the outer loop cycles. Also note that you have More... parameters like Read Limit that can control how often your Loop loops.

And, not afraid to repeat myself, I suggest you fire up your AL in the Debugger (https://ibm.biz/Bdjiy3). Stepping through the loops and viewing data can provide insights.

Also note that unlike the implicit loop of Feed > Data Flow, the Work Entry is not emptied out at the top of each Connector Loop cycle. As such, you may need to add script in a Hook (like Before GetNext) to remove attributes from the previous cycle.

-Eddie

Loading...