In a view I need to display a node's fields in multiple rows, how can I achieve that?

The node contains:

I need the display to be in a table as (for example)

Port Arrival Departure
Istanbul 1/1/11 2/1/11
Mersin 2/1/11 4/1/11
Mykanos 5/1/11 6/1/11

When I used table, it puts all fields on the same row, as it detects the view contains only one node. I tried with grid..played with settings, no luck. I tried Views Secondary Row and it only works when I need to have two rows, not more...

How can I achieve this with views formats?

  • Is there a reason not to create a content type of say, 'Port' and have each port be a separate node? – Laxman13 Jun 16 '11 at 21:26
  • This is a voyage node, and it is a collection of ports and dates of arrivals and departures. every PORT field in VOYAGE (port1name, port2name, port3name..etc) is a reference node to a port node that has description and picture of the port.. – Postscripter Jun 20 '11 at 19:44
  • @Postscripter : Have you solved this – Cindrella Sep 28 '12 at 7:28
  • No. and I canceled my project. I faced a lot of issue trying to build my cruise booking system with Drupal, with no knowledge in codes. – Postscripter Oct 6 '12 at 15:24

Drupal 7 Field API handles this case very well. I rewrote the Office Hours module using the Field API. Each row has day of week and time open and time close. This would be exactly the same for you except instead of day or week it would be port, time open would be time of arrival and time close would be time of departure.

The solution is to build a custom module with Field API in Drupal 7. Are you using Drupal 7?

  • It sounds like the OP wants all the data in the view to be pulled from a single node instead of multiple nodes – Laxman13 Jun 16 '11 at 21:25
  • Yes am using Drupal 7. I never done any php coding. So to be able to write a custom module with Field API, where do you recommend me to start from? – Postscripter Jun 18 '11 at 14:18
  • Can you managing with the date being text by writing "6/17/2011" instead of having to use a date picker? I have a similar module built but if I'm going to re-purpose it, it needs to be tested and maintained which is a lot more work than I'm about to accept right now. – Adam S Jun 18 '11 at 18:16

Can't you just try to use unformatted rows? They will stack one after the other if you do that. Do you need the display to do anything else?

  • I need it in rows by port so the first row will include: Port1Name, Port1Departure,Port1Arrival Then the second row will include: Port2Name, Port2Departure, Port2Arrival....etc – Postscripter May 24 '11 at 16:57
  • I'm struggling to understand exactly what you mean. Are all of these fields in one node? Do you have a link I could have a look at? – Jamie Hollern May 24 '11 at 19:45
  • Yes the "Voyage" node has these fields: Port1Name,Port1Departure,Port1Arrival,Port2Name,Port2Departure,Port2Arrival,Port3NamelPort3Departure,Port3Arrival Now I need to show these fields in a table in this format: Row1: Port1Name,Port1Departure,Port1Arrival Row2: Port2Name,Port2Departure,Port2Arrival Row3: Port3Name,Port3Departure,Port3Arrival Is this clearer now? – Postscripter May 25 '11 at 15:00

Because this type of information is tabular you can use CCK Tables or the Table Field module.

  • this is not practical for my site, as I will need the fields to do other operations. For example Port1 is reference node that links to a port node with picture and description of the port – Postscripter Jun 20 '11 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.