Discussions
RPL loop data within loop data

I am having trouble with an RPL loop inside an RPL loop.
My setup is as follows:
SQL view campaign_dist (filters only members of this particular campaign)
Contains CUSTOMER_ID
SQL view campaign_members_distinct (contains deduped/distinct list of campaign members)
Contains CUSTOMER_ID, POLICY_NUMBER, MEMBER_NAME, PRODUCT_NAME, PRODUCT_TYPE
One Customer ID can match to many POLICY_NUMBERs
SQL view campaign_policy_lookup (contains all data)
Contains all data, not deduped
Each member might have multiple policies, so this requires us to loop the policy data under the a loop of members. This way we end up with a header for each member, and a listing of the policy information below their name
POLICY XXXX001 - JOHN SMITH
Product name = Product1
Product type = Type1
POLICY XXXX002 - JANE DOE
Product name = Product1
Product type = Type2
Product name = Product2
Product type = Type2
Keeping in mind one CUSTOMER_ID can contain multiple POLICY_NUMBERs. The POLICY_NUMBERs can match to multiple Product names and Product types.
When only one Policy number exists for the CUSTOMER_ID, the loop executes as expected and shows all products related to each Policy ID.
However, when multiple Policy numbers exist, only one product is listed, even if they have multiple products. The data tables used for both these loops are the same.
Any input on why the loop is stopping on the first product listing would be helpful.
<!--BEGIN POLICY LOOP-->
<#data campaign_1yr_ph as campaign_1yr>
<#filter CUSTOMER_ID_=master_profile.CUSTOMER_ID_>
<#fields CUSTOMER_ID_ POLICY_NUMBER MEMBER_NAME>
Policy ${campaign_1yr.POLICY_NUMBER} -- ${campaign_1yr.MEMBER_NAME}
<!--BEGIN PRODUCT LOOP-->
<#data CAMPAIGN_1yr_lookup as campaign_1yr_lookup>
<#filter POLICY_NUMBER=POLICY_NUMBER>
<#fields POLICY_NUMBER ALLOCATION_OPTION NEXT_ANNIVERSARY>
Allocation Option: ${campaign_1yr_lookup.ALLOCATION_OPTION}
Next Anniversary Date: ${campaign_1yr_lookup.NEXT_ANNIVERSARY?string["EEEE, MMMM d, yyyy"]}
</#data>
<!--END PRODUCT LOOP-->
</#data>
<!--END POLICY LOOP-->