Compare field values (date) across entries in the same form

By: Michael Tidbury | Asked: 09/20/2024
ForumsCategory: How-toCompare field values (date) across entries in the same form
Michael Tidbury asked 2 weeks ago

I have a form with a list of Newsletter issue dates in UK format, each entry is an issue.

In a view I want to display numbers of days between the sequential entries. The view is sorted by Issue date.  

               Publication date -------------- Number of days since last issue

Entry 1 - 7 March 2024 ----------------- 0

Entry 2 - 14 March 2024 --------------- 7 IE 14/3/24 - 7/3/24 (from Entry 1)

Entry 3 - 29 March 2024 --------------- 15 IE 29/3/24 - 14/3/24 (from Entry 2)  

Is it possible to do this? I have hunted through documentation and cannot see a way to do it but equally I cannot find a specific place where it says it cannot be done.

Many thanks,

Michael.

1 Answers
Rob LeVineRob LeVine answered 2 weeks ago
There's one, a dare say, clever way to do it, though I'm assuming you haven't released it yet and have no real data. Create a hidden field "difference". Whenever an entry is created (or updated), you calculate the difference between it and the previous entry and still the result in "difference". Then in your view, you reference that hidden field.

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right