Skip Navigation

[Resuelto] Is this the correct way to do this view?

This support ticket is created hace 6 años, 3 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Etiquetado: ,

Este tema contiene 5 respuestas, tiene 2 mensajes.

Última actualización por Christian Cox hace 6 años, 3 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#1083866

Hi,

complex views still confound me. I want to make sure I'm doing this the most efficient way.
PLEASE NOTE: ALL my views are in table format.
CPT's:
Works
Tracks
Writers

Relationships:
Works-Tracks (one2many)
Works-Writers (many2many with invisible intermediary cpt that has fields)

My view: (to display all results)
show all tracks with fields from works, writers and writer intermediary.
Showing the fields from "works" is easy.....
showing the writer title and intermediary field took me awhile

Here's what I did - it works but I want to make sure it's the correct way to do it.

VIEW: (to display all results)

view 1 - content selection = tracks
within view 1 is view 2 and view 4

TO GET WRITER TITLE:
view 2 - content selection = works
Filter: Select posts in a Works Tracks relationship that are a related to the current post in the loop.
the ONLY thing within view 2 is view 3
view 3 - content selection = writers
Filter: Select posts in a Works Writers relationship that are a related to the current post in the loop.
view 3 has: [wpv-post-title]

TO GET WORK-WRITER INTERMEDIARY FIELD:
view 4 - content selection = works
Filter: Select posts in a Works Tracks relationship that are a related to the current post in the loop.
the ONLY thing within view 4 is view 5
view 5 - content selection = writers
Filter: Select posts in a Works Writers relationship that are a related to the current post in the loop.
view 5 has: [types field='writers-share' item='@work-writer.intermediary'][/types]

again, even though this works - is it the right way/ most efficient way to do it?

Thank you!!

Scott.

#1083963

This looks okay to me, but efficiency is somewhat argumentative. For example, I think Views 3 and 5 could be combined conceptually, but maybe not visually. In other words, if the Writer Title and the intermediary fields could be displayed by the same Loop, then a single View could be used for both and would be more efficient than two separate Views. However based on the visual design, this may not be possible. It depends on how the content is organized and output on the screen.

In terms of performance, nested Views with multiple query filters and post relationship queries will always have some impact on your page load time, by nature of how database queries work. As content grows on your site, these hits may become more noticeable. If there is a noticeable, negative impact on page load time, you may consider adding a caching plugin, limiting the number of results shown, and/or implementing pagination for Views.

#1083973

Thank you Christian.
Yes, performance might definitely be a problem down the road.
This is a Multi site - each user has a subsite
Unfortunately, for each user:
1. they may have 1000's of tracks over time
2. they need to be able to export all tracks with all fields into a spreadsheet (tables are being rendered via datatables.net code)
which means
Tables can't be server side in order to export all tracks/ all fields.

once I get everything set-up I will be testing with a large catalog of tracks.

thanks!

#1083978

Okay if you're using datatables, then the order in which data is provided by the View may not be as important. That can be helpful for efficiency by reducing the number of required Views. The data that is output by Views will be in some JavaScript format, which you should be able to manipulate before passing it into the datatable. That means you can reorder columns however you want with a bit of JavaScript knowledge.

view 3 - content selection = writers
Filter: Select posts in a Works Writers relationship that are a related to the current post in the loop.
View 3 has: [wpv-post-title] AND [types field='writers-share' item='@work-writer.intermediary'][/types]
Views 4 and 5 are no longer necessary.

I'll stand by for your update following the tests you mentioned.

#1083995

hmm...I don't quite understand this.

I, need, as much as possible, for each field to have a column (in some cases not possible)
see this page for instance...I don't even know if I could re-create this view, it's so complex to me.
It queries:
works-tracks (one2many)
works-writers (many2many with intermediary fields)
works-publishers (many2many with intermediary fields)
tracks-clients (many2many with intermediary fields)

see here:
enlace oculto

you don't need to get into the details now - maybe we can revisit once I've imported the catalog.

Thanks!

#1084014

Fair enough, I'll stand by for your update.