Score:0

Views filtering by two values from same field and comparing with another time field

us flag

I have a customer which works with buses and passenger transportation.Now he would like that all routes would be visible on a site and guests could filter routes by source and destination points.
Routes examples:

Route A-E
StopA 08:10
StopB 08:20
StopC 08:30
StopD 08:40
StopE 08:50

Route E-A
StopE 09:00
StopD 09:10
StopC 09:20
StopB 09:30
StopA 09:40

Now client wants Search fields Source and Destination and for example if Source has value StopB and Destination has value StopC than user should only see Route A-E

How I'm doing this:

Firstly I created a new paragraph and added two fields in it: stop(text field) and time (time field)
enter image description here
Then I Created a content type Routes and added newly created paragraph
enter image description here
When I'm creating a new Content of Routes I can add as many stops with time as I like.
enter image description here
I created a view:
enter image description here
It shows all data as expected
enter image description here
I added Relationship field_stops: Paragraph
After that data multiplied 5 times same amount as routes in Content. Why is that?

Then I was able to add Filter Criteria field_stops: Paragraph

Now if I type StopB in filter field it filters both routes: Route A-E and Route E-A and it's normal because both of them has StopB value

enter image description here

Now I need ideas how can I add another filter field and search for both values in Routes. And how to implement source and destination route? Can it use time field?

I hope I'm clear with my question

Naveen avatar
id flag
Well its combine filter check this hope it helps you https://befused.com/drupal/views-combined-filter/
us flag
Thanks for a hint. I checked the link but it says: In order to use this, the view format needs to be set to show fields. It doesn’t work if you want to display rendered entities as there are no fields to combine. And Paragraph is Rendered entity so I can't select these fields.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.