Skip Navigation

[Resolved] I need to display DISTINCT records

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.

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

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#2519797

Tell us what you are trying to do? To display DISTINCT records. I searched the forum and it seems that there is no solution. I thought I would try asking, just to be sure before moving outside of Toolset.

I have workouts that can contain the same exercise in different tasks.

From the exercise listing, I want to be able to list the workouts that the exercise is used in. If the exercise links 10 times to the workout, it would display the record 10 times. I need to be able to select distinct records. Is it possible without going outside of toolset?

#2520739

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

Your observation is correct and Toolset doesn't support multiple instances of many-to-many relationships.
( i.e. two same posts can't be joined together multiple times )

Here is a workaround that can be used for a requirement like this:

1. You'll need these 3 custom post types:

a). Exercises
b). Workouts
c). Workout Items

The new post type "Workout Items" will actually hold an individual post for each instance of an exercise that is a part of a workout. For example, if a workaround consists of a total of 20 exercises, there will be 20 posts for this workout in this post type.

2. And to link these custom post types, together, you'll need these post-relationships:

a). Workout Items - Exercises ( One-to-One relationship )
b). Workout Items - Workouts ( One-to-One relationship )

This shows that instead of a direct link, the exercises and the workouts will be linked together, through a common post type 'Workout Items'.

I hope this helps and please let me know if you need any further assistance with this.

regards,
Waqar

#2520787

I'm not sure, but I think that you are saying to create another relation to keep track of the exercises as one related item? I.e. more work. If correct, that's not something I would do. I would just go outside of toolset and do a query.

#2521353

Can you confirm that is what you're saying?

#2522507

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

Your understanding is correct and I can understand that this setup will result in more work, in terms of adding/managing relationship records. But, based on what we've discussed, this is the only workaround that I can think of, considering the features, available out of the box.

#2524213

My issue is resolved now. Thank you!

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