Jump to content
Pixrael

How to access to a specific repeater item based on a field value?!!

Recommended Posts

I have spent the whole day searching the forum without finding the answer! It seems that the only way to use the repeaters is using FOREACH! I have a template with a repeater field assigned, on the Page I already have several records saved in the repeaters and I need to access the information of one of the repeater items, but in order to select it I need to ask for the current value of one of the item fields.

Ex:

Page
- Repeater Field
--- Item1
----- FieldA = 2
----- FieldB = BAR
----- FieldC = FOO
--- Item2
----- FieldA = 6
----- FieldB = FOO
----- FieldC = BAR

I need to get the FieldC value of the item that has value=2 in the FieldA

????

Share this post


Link to post
Share on other sites

Oh! So easy? !!! .. I'll try it tomorrow at the office. THANK YOU!

Share this post


Link to post
Share on other sites
12 hours ago, elabx said:

$page->repeater_field->get('FieldA=2')->FieldC

It Works! THX!

  • Like 1

Share this post


Link to post
Share on other sites

I spent almost 2 days of searching for that stuff...

Thank you! I love you 🙂

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...