[Resolved] Can’t get repeatable group to output data
This thread is resolved. Here is a description of the problem and solution.
Problem: I have an RFG that includes another nested RFG, but I'm having trouble showing fields from both RFGs in a View.
Solution: Use post relationship query filters and the Post Selection tab to create Views that display custom fields from all the different levels of hierarchy.
Maybe it's because I've coded in PHP and javascript (jQuery) and long before that in Visual Basic that I am encountering so many brick walls attempting to do even simple things...maybe I'm just too used to typical coding . I do find that the product design itself is way more complex than it needs to be. It seems like it's been designed by scientists or PhD's even though it's intended for regular WordPress users and developers. Of course the bugs I've found (although to be fair, they are technically just design flaws, but still...) don't help, because I never know if I'm doing something wrong or if it's operating in a totally unexpected and undocumented way. And speaking of documentation, because there's so little of it (the documentation seems to be thousands of possibly-related past support tickets of others, that take hours to sift through) I find that for anything except that absolute basic things requires assistance from a support technician. I suppose that's the strategy--to put the money into staffing the support team rather than improving the intuitiveness of the design--which is not necessarily a bad strategy, because you get to speak with your user group frequently. Anyway, enough of my rant...
I have set up a repeatable group "Package" that contains a field "Package name" and a nested repeatable group "Package Details" which contains 4 other fields. See image 1.
I have created a view "pricing-packages-list". Content selection = "Package" (repeating group). Query filter = "Select posts in Any relationship that are related to the Post where this View is shown."
I'm basically duplicating what I did (again, with help from tech support because none of it is documented) with another set of nested repeating groups. But when displaying this view it shows "No items found". Not even the outside
Okay assuming the Packages RFG is applied to the post where the View is shown, I can't see an obvious reason why this isn't working. I'll be glad to take a closer look if you provide login credentials here and show me which post you are testing with.
In the outer View, I see the setting "Order by field - Nights". However, that doesn't really make sense here because there is no "Nights" field directly in the Packages RFG, only in the nested Package Details RFG. So there could be multiple "Nights" values for any one Package RFG. This is why no results are appearing in the outer View, it's a quirk of how WordPress meta queries work. If the field you're querying by doesn't exist or has no value for some post (or in this case RFG), then that item will not appear in the search results. As a quick test I changed this to Post Date and I saw several results appear, but I reset it to the original setting so you can choose the appropriate option.
Let me know if the results aren't more like you'd expect.
That did it...thanks, I never would have figured that out (as again it's not documented and totally not intuitive). Now that I'm able to render output of the view, I've tried to include a value from the outer loop (view is "pricing-packages-list") when outputting the inner loop ("package-row"). I want to output the field "Package name" which is part of the "Package" RFG when looping through the "Package Details" RFG in the inner loop.
When you insert a field using the Fields and Views button, you'll see a popup appear where you can choose different settings for the field. On the left side there is a Post Selection tab. This is where you can choose the source post that contains the field. In this case, RFGs are handled the same as parent/child post relationships. You'll choose to display information from a related post, and select the inner RFG name as the relationship you want to query.
Oh I misunderstood the RFG hierarchy and gave you the wrong identifier. It should be package-details.parent, since the nested RFG is Package Details and you want the package name from the parent Package Row.