I have a problem with this Loop because there are 8 rows in the DE and when I execute the code below, the preview only shows 6 content blocks.
The last one it displays, also has a loop inside and calls another content block by Id.
Is that something that affects it? I think it does, because if instead of %%=ContentBlockbyId(@contentBlockId)=%%
I add %%=v(@contentBlockId)=%%
I get 8 results, one Id per row.
What can I do so that this loops finish with all the content and does not ends if a content has a loop inside?
%%=ContentBlockById('162810')=%% -->This is an AMPScript content code outside DE <--
%%[
VAR @ContentRows, @ContentRow, @RowCount, @numRowsToReturn, @RowCounter, @emailName
SET @numRowsToReturn = 0
SET @emailName = "XYZ_Order_Confirmation_Email"
SET @ContentRows = LookupOrderedRows("XYZ_Content_Blocks_Order_Coco", @numRowsToReturn, "ContentOrder asc", "Email", @emailName)
set @RowCount = rowcount(@ContentRows)
IF @rowCount > 0 THEN
FOR @RowCounter = 1 TO @rowCount DO
VAR @contentBlockId, @contentBlock
SET @ContentRow = row(@ContentRows, @RowCounter)
SET @contentBlockId = field(@ContentRow,"ContentId")
]%%
%%=ContentBlockbyId(@contentBlockId)=%%
%%[ NEXT @RowCounter ]%%
%%[ ELSE ]%%
No rows found
%%[ ENDIF ]%%