Support

Account

Home Forums General Issues What does the Repeater value stored in the DB represent?

Solved

What does the Repeater value stored in the DB represent?

  • Hi there,

    I’m just wondering what the repeater values (not children) represent in the database?
    Is it a count of how many fields there are for that particular repeater?

    Repeater DB

    https://ibb.co/5rpW7Vs

    I have attached an image of a simple repeater with a text field, the field marked ‘repeater’ with the value of 2 is what I am asking about.

    Many thanks.

  • The value stored for the repeater is the number of rows it contains.

  • Thanks for your reply,

    Just out of curiosity, is there a reason why ACF needs this count? And where is it used?

    Many thanks.

  • So that it knows how many rows to get from the db. The sub field names are derived in a loop something like

    
    foreach ($i=0; $i<$rows; $i++) {
      $sub_field_meta_key = $repeater_name.'_'.$i.'_'.$sub_field_name;
    }
    

    It’s not exactly that, the example is extremely simplified.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.