Looper nested data using Custom + Array - out of scope?

Hey Guys,

I have a nested Looper running on Pro 5.0.6 that seems to have a scope issue.

I have a Custom loop that returns an array, and inside that a Div tag that makes use of the Array looper feature; this works perfectly.

However, I cannot assign looper fields to that Div from the original Custom loop, despite still being in scope.

For example, I cannot insert the ID from the parent Looper field (Yes, this 100% exists :D) into the ID of the object.

tao_ems_{{dc:looper:field key="ID"}}

Here’s the parent Custom loops data - the slider works, proving the data is there, and the ID is used in other places in scope, above this DIV - but it seems to not work, possibly because I’ve set a Looper Provider of Array at the same level?

This is an active build, so would appreciate some advice here :wink:

Kind regards,

Matthew

Hi Matthew,

Unfortunately I think you might need an extra Div here. I’ve double checked this and enabling a Looper Provider will unset the current scope. Ideally, it would work like you have it setup and not lose access to the current consumer until the next consumer runs - even if a Provider is enabled somewhere in the chain. I’ve added this to our issue tracker so we can look into it and hopefully make that possible, but I can’t provide an ETA on when that will be available.

Meanwhile, it should work if you place your provider in another nested Div element.


As an aside, something the might help while you’re working with complex loopers is using some internal debugging tools we have. Try adding these in a text or Raw Content element:

{{dc:looper:debug_provider}}
{{dc:looper:debug_consumer}}

The debug_provider will give you some basic meta data about the current provider and debug_consumer will give you all the data in scope.

Hey @alexander,

Thanks for the feedback, I’ll figure out a work-around with some additional JavaScript but thanks for the tips about the debug tags - that is very useful!

Really appreciate it.

Thanks,

Matthew

Ok, sounds good!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.