0

How do I get count for this scenario? Each row returns "1":

{grid_field}
  {grid_field:relationships_field}
    {grid_field:relationships_field:count}
      // incorrectly shows 1 for each row
  {/grid_field:relationships_field}
{/grid_field}

Count works fine for the grid field.

EE 2.10.1

1

Your code is right. You need to pass relationships field with grid prefix like this:

{grid_field}
  {grid_field:relationships_field}
    {grid_field:relationships_field:count}
      // incorrectly shows 1 for each row
  {/grid_field:relationships_field}
{/grid_field}
4
  • You beat me to posting by a minute. Sep 1 '16 at 15:10
  • Next time mate :) Sep 1 '16 at 15:13
  • My apologies, I made a mistake in the question. I have in fact passed the relationships field with a grid prefix (I am successfully pulling data from the related entry but cannot get count). Question updated. Sep 1 '16 at 16:03
  • Now it's working... Must be one of those days - no idea what the problem was, but I'll mark your answer as accepted anyway as it is the correct syntax. Sep 1 '16 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.