Skip Navigation

[Resolved] New Entry Tracking

This thread is resolved. Here is a description of the problem and solution.

Problem:

Setup a vehicles Tracking systems.

Solution:

I suggest you setup a child post type for it, for example:

https://toolset.com/forums/topic/new-entry-tracking/#post-1686143

Relevant Documentation:

https://toolset.com/documentation/post-relationships/how-to-set-up-post-relationships-using-toolset/

This support ticket is created 4 years, 5 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.

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/Hong_Kong (GMT+08:00)

This topic contains 20 replies, has 2 voices.

Last updated by larryL 4 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1707897

Ok THANKS Luo! This was fantastic and I appreciate your patience working with me through this.

I have one things left to do: combine my forms: right now I have two forms (1 that adds a new vehicle into the 'vehicle' CPT, and another that adds a new vehicle into the 'vehicle movements' cpt).

What I really want to be able to do, if possible, is present one form (at least from the user's perspective where they enter the VIN. If it already exists then the form pre-populates and they can only create a new 'vehicle movement' cpt (with some fields editable), if the VIN does not exist then they add a new vehicle in 'vehicle' cpt.

Is this possible? If it's not, is there a way to get close to what I want to do?

New threads created by Luo Yang and linked to this one are listed below:

https://toolset.com/forums/topic/i-have-one-things-left-to-do-combine-my-forms/

#1707913
testpage.PNG
main.PNG

One more thing. I went through the pages you sent and the 'vehicle movements' recent view does not work as intended.

If you add more than one entry with the same vin it does not show the most recent one. For example, I duplicated your view and modified the loop to make it into a table and double checked that the out put was the same as before (it was). Then I added two more vehicle movements for an existing VIN but none of them appeared in the table. See screen shots attached. (Main) is the home page showing all three vehicle movements not using the view you created with my modification. testpage is with the view you created but with my modification (?page=views-editor&view_id=2260).

Also, I noticed that your third view isn't showing up - the one that calculates how long a vehicle has been in one location. Where is that located?

#1708299

According to our support policy, we prefer one ticket one question, For the new questions:
https://toolset.com/forums/topic/new-entry-tracking/page/2/#post-1707897

Please check the new thread here:
https://toolset.com/forums/topic/i-have-one-things-left-to-do-combine-my-forms/

Q1) If you add more than one entry with the same vin it does not show the most recent one.

In home page, it is not a single "vehicles" post, so you will need to setup a nested view:
1) Parent post view:
- Query "vehicles" posts
- In view's loop, display below child post view

2) Child post view:
- Query "vehicle movement" posts
- Display only one item, and order by post date descending
- Filter by post type relationship between "vehicles" and "vehicle movement"
- Display "vehicle movement" information

Please have a look at the document I mentioned above:
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/#displaying-many-related-items

Q2) I noticed that your third view isn't showing up - the one that calculates how long a vehicle has been in one location. Where is that located?
I did not setup the third view in your website, it should use the same setting of first view, and output a custom shortcode to calculate days between the post date and now, Please check the my answer above:
https://toolset.com/forums/topic/new-entry-tracking/page/2/#post-1704869

#1709025

Forgive me Luo but I don't think you understand what I'm trying to accomplish. This view is NOT in a post so it wouldn't be related to anything. It's a list of vehicles on a page. This is not a situation where a user clicks on a vehicle and is looking at a vehicle details page and I'm trying to display 'related vehicles'. Let's go back to the original question.

Once a user enters a new vehicle movement (with the same VIN) how can I only display the most recent entry in the list?

We could either do this with one CPT (vehicles) or with your idea of two CPTS 'vehicles' & 'vehicle movements'. But either way a new post will be entered each time when the VIN is found.

#1709457

OK, lets back to the original question.

Without two post types "vehicle" and "vehicle movement", how can you track the vehicle movement history?
Without history records, how can you find the latest "vehicle movement" of specific "vehicle"?

I don't find other workaround than two post types within Toolset.

#1715469

My issue is resolved now. Thank you!