Skip Navigation

[Resolved] Creating a distinct item whilst using a nested view

This support ticket is created 6 years, 8 months ago. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by Shane 6 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#559671

The URL I'm working on is
hidden link

First of all please ignore the first item in the list.
The output is a list of artists names and under name a list of of their known works - which is held in a custom type

looking like this
artist1
works1
works 2
artist 2

and so on.

A bit like using a select distinct on the artist name.

My approach so far has been 1 view for the artist name and 1 view for the works. Hoping to place the view containing the works in the wpv_loop to achieve output

However I've not been able to get this to work - neither have I been able to create a distinct list. I have tried putting the artist name out of the loop - and so far only succeed in the name not appearing.

As you can see though - I've not achieved correctly linking up the works to the artist or a distinct list of artist names. Any idea what I am stupidly doing wrong?

#559694

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

Thank you for contacting our support forum.

It seems what you are looking for is a multi dimension array 🙂 where you have a view in a view.

Take a look at the link below and let me know if this helps.

https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

Thanks,
Shane

#559853

Thanks Shane

That was a big help - I'm considerably closer now, but not quite making the final step.

Do you have any other pointers on this?

#560000

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

Could you provide a little more information on the final step that you are talking about ?

Thanks,
Shane

#560054

My apologies Shane
I've managed to tie the child view to the primary - all Works types items are listed under the correct artist. Which is a great step forward

What I'm failing to do is how to get one only of each name so I can list the relevant items underneath it.

Thanks
Rob

#560091

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

It should be as easy as adding the child view to the parent view.

The parent view will list the name once and then the child items under unless i'm misinterpreting.

Is there any example that I can see ?

Thanks,
Shane

#560363
artistslist.png

Hi Shane

thanks

I think the issue is that following the instructions I am not able to set the Name field to not repeat - ie one copy of each name. Dropping the child view in seems to be working perfectly. Its the repetition of the name that's the issue

You can see this at this URL
hidden link

I've also attached a drawing that describes the output.

If I put the name in the loop - i get the above - and outside I don't get anything. I suspect we have a small configuration issue.

#560395

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

It seems that this is because these names could belong to multiple parents. I would need to check the relationships to give a definite answer but I believe this is why.

If this is the case then their isn't a way to stop the repetition because of how the logic works.

The private fields will be enabled for your next response.
Thanks,
Shane

#560851

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

So I see here that you have a CPT called Acquisition and you are using 2 views one to list the Artist and another to list the works.

However i'm a bit confused with your data setup as i'm not able to tell the artists separately from the works. It seems that the Artist names are attached to the works themselves which will make it not possible to give the setup that you want.

What I would recommend doing is to change your setup, though you have so many items. This means that you will need to separate your Artists from their works.

So you will have 1 CPT called Artists which will be the Parent of another CPT called works. This way you can setup a relational view that will lists all the Artist's works under their names as you like it.

Please let me know what you think about this.

Thanks,
Shane

#560917

Hi Shane

I think you are correct. We have a single entity that is essentially a flat file of artists and works.
This is historic as we are bringing in an existing very simple is into the site.
I was hoping that we could nest one view in another we could achieve the result. But thinking about in terms of relationships changes that.

The users need something like a very simple form to access the data. Would it be possible to build a form that updated a list of artists and a list of works? IE - keep the form use similar but build something that is relational?

Thanks

Rob

#560982

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Robert,

You can use our CRED plugin to recreate the information, but since the Artists would be the Parent then the Artists form would need to be made and filled out with all the artists.

Then you can create a second form for Works and then you should be able to add all the works and then select which artist each work belongs to.

Thanks,
Shane

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.