Entry listing based on 2 fields

By: Andres Garcia | Asked: 07/18/2023
ForumsCategory: General questionsEntry listing based on 2 fields
Andres Garcia asked 9 months ago

I have a form that contains the fields: Store, Date, UPC, Qty. How do create a list that includes one instance of each unique combination of the 'Store' and 'Date' fields. For example, if these were my entries in my database:

Store, Date, UPC, Qty
1, 2023-01-05, 12345, 5
1, 2023-01-05, 8675309, 12
1, 2023-01-05, 123254, 3
2, 2023-01-05, 12423, 6
2, 2023-02-01, 42323, 13

Then I would like a listing showing just:
1, 2023-01-05
2, 2023-01-05
2, 2023-02-01

1 Answers
Rob LeVineRob LeVine answered 9 months ago
I was hoping someone else would answer and since that didn't happen, I'll give my standard answer on how to accomplish complex stuff in a view. Create a view and set the view's main content to be a custom shortcode. The shortcode's PHP can execute the necessary queries to generate the data and you can return back the HTML to generate the table rows. That is one way to accomplish it.

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