All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

How to get a total row count from a Low Variables Matrix

Chad Clark 21 Aug 2012 19:53 question, complete

Hello,

I am having trouble figuring out a way to output the total rows from a Low Variables Matrix field. Any help is appreciated.

Replies

  1. Low 21 Aug 2012 20:03

    Hi Chad,

    You'd need to use the {total_rows} var inside a {exp:low_variables:pair} tag:

    {exp:low_variables:pair var="matrix_var"} 
    {total_rows}
    {/exp:low_variables:pair}

    Ian 15 Apr 2013 16:41

    Given the nature of how Low Variables handles Matrix fields, wouldn't this repeat the total_rows count by the number of rows in the Matrix?

    Low 16 Apr 2013 06:48

    It would. But you could add something like {if count == 1} ... {/if} to it, or the Matrix equivalent.

    Ian 16 Apr 2013 17:54

    Would there be any way to invoke the single-tag version through LV (e.g. something like {exp:low_variables:total_rows var="matrix_var"}), or would something like that take an update on the Matrix side of things?

    Low 17 Apr 2013 10:08

    It'd be a Matrix thing. Something like {exp:low_variables:parse var="matrix_var" method="total_rows"}

  2. Chad Clark 5 Oct 2012 17:39

    Hi Low,

    Thank you!

  3. Sean Delaney 19 Sep 2013 09:03

    Hi guys

    I have:

    {exp:low_variables:pair var="lv_monday_pt_availability"}
    {total_rows}
    {/exp:low_variables:pair}

    But the total rows value prints out twice. See Monday:

    http://jamfitness.me/personal-trainer...

  4. Low 19 Sep 2013 09:12

    You can use a conditional like so:

    {if row_count == 1}{total_rows}{/if}

  5. Sean Delaney 19 Sep 2013 09:13

    Fair enough. :)