migxLoopCollection output to individual field placeholders?

Is there a way to have one migxLoopCollection call but output the results by the individual fields in their own placeholders instead of one template chunk?

For example if I have a members TV with fields like name, age, phone, email, etc., how can I do something like this:

  &where=`{"id": "[[+memberId]]"}`]]


// instead of:

  &where=`{"id": "[[+memberId]]"}`]]

  &where=`{"id": "[[+memberId]]"}`]]

I saw there is quite a few renderOutput - properties but unfortunately not much of an explanation on how to use them and as some of them are very familiar, I couldn’t figure out if one of the others was doing what I need.

I believe if you use the property toPlaceholders


you should be able to use the placeholders [[+member.name]] or [[+member.age]].

That seems to work in general, although I have this TV nested inside a regular migx TV categories and starting with the second instance of that, the displayed values of the members are wrong, despite the right IDs are getting called for.

  "caption": "Categories",
  "fields": [{
    "field": "category",
    "caption": "Category"
    "field": "memberlist",
    "caption": "Member",
    "inputTV": "member"    // migxdb config tv

[[+member.name]] ([[+memberId]])

Category A
- Member Joe (1)    // correct
- Member Jane (3)    // correct
- Member Tom (7)    // correct

Category B
- Member Tom (2)    // wrong name, right ID
- Member Tom (5)    // wrong name, right ID
- Member Tom (4)    // correct

Whenever I duplicate a category, all new entry names will be the one from the last entry of the previous category, although if I change the order or remove and add members after that, it will switch up, so I couldn’t find a totally consistent pattern here.

I suspect the placeholders must be interacting with each other across the individual category instances?

I’m struggling to understand how exactly you are outputting your data.
Can you provide this information?

In my view, it’s probably simpler to create a custom snippet than trying to combine getImageList and
migxLoopCollection and guessing how they work.

I think, this has todo, how MODX tags are parsed.
If a tag is parsed once within a request, the same tag with the same footprint will allways return the same (first) output.

You will need to set different placeholders for each loop within the migxLoopCollection - call. Maybe try &toPlaceholders=`member[[+id]]` and [[+member[[+id]].name]]

That’s what I suspected as well.

That’s a great idea, it work but you have to use [[+idx]].

Thanks a lot for all your help!

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.