Forum

Thread tagged as: Question, Events, Field-Types

Relational stuff in Perch

I have a 'Venue' page where I can add details of a venue including opening hours. Different venues have different opening hours.

When I create a new Event (with the Event app) I choose a venue from a dataselect list. I need a way to auto select the opening hours based on which Venue I have chosen, but I'm not sure how to do this. I thought I'd just use another dataselect or pagelist to select Venue > Opening Hours, but I can't see how to do this simply.

Could you point me in the right direction? Thanks!

Mat Ranson

Mat Ranson 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you give an example?

On my Add Event page I choose a 'locationName':

<!-- LOCATION -->
    <perch:events id="locationName" label="Location" type="dataselect" page="/venues.php" region="Venues" options="locationName" order="2" values="slug" />

Then I want to make sure the Event shows the 'locationHours' (opening hours) I also set for that venue when I added it:

<!-- OPENING HOURS -->
<perch:events id="locationHours" type="dataselect" label="Hours" page="/venues.php" region="Venues" options="locationHours" values="slug" />

But this gives me a list of ALL the opening hours. Ideally I could just autoselect the hours based on the venue I already selected. However I could still use this dataselct if I had to, as long as I knew which hours relate to which venue....

Drew McLellan

Drew McLellan 2638 points
Perch Support

There's not a way to do that with dataselect.

Are you using regular Perch rather than Runway?

Not yet. I checked out Relationships and clearly this is what I need.

Although a version of the above code I can do what I want if I do a dataselect and just reselect the Location Name again, using

<perch:events id="locationHours" type="dataselect" label="Hours" page="/venues.php" region="Venues" options="locationName" values="locationHours" />