Pixrael Posted June 14, 2019 Share Posted June 14, 2019 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 ???? Link to comment Share on other sites More sharing options...
elabx Posted June 14, 2019 Share Posted June 14, 2019 Repeaters are output as PageArray (or rather a class that inherits from it, called RepeaterPageArray), so you have all the methods from a WireArray such as: https://processwire.com/api/ref/wire-array/get/ https://processwire.com/api/ref/wire-array/find/ $page->repeater_field->get('FieldA=2')->FieldC 9 Link to comment Share on other sites More sharing options...
Pixrael Posted June 14, 2019 Author Share Posted June 14, 2019 Oh! So easy? !!! .. I'll try it tomorrow at the office. THANK YOU! Link to comment Share on other sites More sharing options...
Pixrael Posted June 14, 2019 Author Share Posted June 14, 2019 12 hours ago, elabx said: $page->repeater_field->get('FieldA=2')->FieldC It Works! THX! 1 Link to comment Share on other sites More sharing options...
Nick Belane Posted July 6, 2020 Share Posted July 6, 2020 I spent almost 2 days of searching for that stuff... Thank you! I love you ? 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now