• Hello xnau and community! (Thanks for this awesome plugin, xnau).

    I’m using the PDB for a runners website. I want to store data all around running events (date, time, track, etc.) for multiple people using a field group called running.

    To display the minimum times of a person out of all collected records, I need to know how to filter min/max values. I can not find any option. (Except using list_limit=1 and order=desc. Problem there is I don’t want visible pagination.)

    Furthermore, I want to display those minimum times from different running tracks (e. g. 10k and marathon) within one table instead of two tables. Problem is that I’m using a checkbox field to select the track for easier .csv-import.

    Expectation:
    Track – Time – Date – etc.
    10k – Minimum time – Date – etc.
    Marathon – Minimum time – Date – etc.

    Reality:
    Track – Time – Date – etc.
    10k – Minimum time – Date – etc.
    Track – Time – Date – etc.
    Marathon – Minimum time – Date – etc.

    So right now I can only realize this by using the pdb_list filter=… two times which is too much.

    To put it all in a nutshell:
    How can I sort a pdb_list by min/max values?
    How can I display several records within one table, that have different (predefined) checkbox values?
    Is there any way to just display like 1 or 5 records without pagination?

    Help highly appreciated!
    Thank you!

    https://wordpress.org/plugins/participants-database/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author xnau webdesign

    (@xnau)

    Well, your problem really is the fact that you’ve got a mixed datatypes going there. What I suggest you do is drop the “K” from your values, and then change the datatype of your column to a numeric type. This is explained on the “Other Notes” page under Sorting Numerically. Then you can use a filter statement like “value>min&value<max”

    Your other questions don’t give me enough context. You can always display a single record by specifying the record ID in the shortcode, and then of course you can do that as many times as you like on the page.

    [pdb_single record_id="123"]

    If you want something more dynamic than that, you’d need to create a custom template.

    If you just want to hide the pagination, you can always do that with CSS:

    .pagination { display:none }

    Thread Starter sharkattackz

    (@sharkattackz)

    Thanks. I won’t change the field for ‘track’ but ‘time’. I just changed the SQL database field type for time from “TINYTEXT” to “TIME” (because I need the entries to be like 01:23:45). Unfortunately no records display after this change. I can’t use Numeric because of the colon.

    I can’t specify the record ID because – at any time – I always want to get the best time out of all records.
    My intention there is to create something like this:
    [pdb_list fields=”time, date, track” filter=”name=XYZ&track=10k&time=min“]

    [pdb_list fields=”time, date, track” filter=”name=XYZ&track=marathon&time=min“]

    With a working min/max value, there should be only one entry per list. Now if I could merge both lists together, I’d have a neat table with all minimum times.

    Thanks for the idea to prevent displaying the pagination. I’m already using this but wanted to know if there is a better solution.

    Thank you for the quick response, xnau!

    Plugin Author xnau webdesign

    (@xnau)

    Yeah, you can’t use a “time” datatype. What you really need to do is much more complicated, you need to create a custom field type that can deal with time values like that, and give you the functionality you need.

    If you’ve got some coding skills, there is a general description for creating a custom form element type on this page: Participants Database 1.5 API

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sorting table by min/max values’ is closed to new replies.