Okay
  Public Ticket #1155263
filter for last rows from multiple groups
Closed

Comments

  •  2
    Martin started the conversation

    Hello, I am trying to display the last entry for each property listed in a table.   Can this be filtered in wpdatatables?   

    Not knowing how to do that I have been trying to modify the db query to import the last entry by property by grouping the property and selecting the highest id per group but I cannot get this query working either.

    SELECT icomprealestatequickstats.id,        icomprealestatequickstats.userid,        icomprealestatequickstats.property,        icomprealestatequickstats.pricedate,        icomprealestatequickstats.listprice,        icomprealestatequickstats.squarefeet,        icomprealestatequickstats.squarefootprice,        icomprealestatequickstats.numrooms,        icomprealestatequickstats.numbedrooms,        icomprealestatequickstats.numbathrooms,        icomprealestatequickstats.locationrating FROM icomprealestatequickstats WHERE id, IN (     SELECT MAX(id)     FROM icomprealestatequickstats     GROUP BY property     );

    Hope you can help.   The things I think should be simple......;)   thnx!

  • [deleted] replied

    Hi Martin,
    Thank you for the purchase.

    When you execute this query in the phpMyAdmin or any other database management software does it returns any data? 

    If the query is not working in wpDataTables plugin and it's working in phpMyAdmin I suggest you to create MySQL View because you are using GROUP BY and MAX functions and then to use that MySQL View for creating tables.

  •  2
    Martin replied

    Hi

    I found a query that works BEFORE I select front end editing.  Do you have any idea why it shows the correct rows when I first create the table in wpdatatables but then shows no result in preview when I select the front end edit option?   I want the user to only see their inputs.

    SELECT * FROM (SELECT * FROM addhomequickstats ORDER BY id DESC) tmp GROUP BY property

    OF COURSE 
    if there is anyway to create a wpdatatable filter to show only the last input row of each group I would love to know how to do that instead of using a mysql query to do it.

    Thanks!


  •  2
    Martin replied

    Hi 

    More on my last reply.   The results of the query i enter into wpdatatable work when:

    -I originally create the table using the default wpdatatable select all and THEN save and enter my query string and save and preview (correct result)

    -as soon as I select Limit Editing to Users Own Data and then apply a filter type to just one column, save and preview THEN no results are found

    Not sure why selecting Edit Users Own and applying one text filter with single line input would change the query results?  

    thnx

  • [deleted] replied

    Hi Martin,

    For Users see and edit only their data feature please take a look at this post from our documentation - Link. When you check this feature you will see just the rows that have your WordPress user ID in User ID column. So if your user has ID 1 you'll see just rows where in User ID column value is 1.

  •  2
    Martin replied

    Thank you.  Yes I understand that.   As I am the admin I am userid1.  I have created no other data under another user name.   All of my test data was created with userid1.  There is another issue.

    FYI I have created other tables as part of this project using the standard mydatatables query and there is no problems.

    I believe there is an issue with the way wpdatatables is handling the mysql query ONLY WHEN the User Own Data is selected AND EDIT TYPE is selected in one column.

    I believe this is deeper than user error.   Hopefully you can help.   thnx!!!!!

  • [deleted] replied

    Hi Martin,

    1. Please provide me the ID of wpDataTable that you are having issue with.

    2. Please provide me a temporary WP-admin login for your site where this happens, so we could log in and take a look ‘from the inside’ as that’s the most efficient way to see and resolve the issue. We do not interfere with any data or anything else except for the plugin (in case that’s a production version of the site), and of course we do not provide login data to third party. You can write credentials here just check PRIVATE so nobody can see it except us.

  •   Martin replied privately
  •  2
    Martin replied

    I have reviewed your documentation a number of times so hopefully you can answer.

    I need a filter to show the last row for each UNIQUE name in the Property column.  

    I am trying to create a filter that will show the row with the HIGHEST id value for each UNIQUE value in the property column.

    How do I filter for "dissimilar" property names?   thnx

  •  1,708
    Miloš replied

    Hi Martin,
    Thank you for your purchase.

    Milos is currently on a vacation so I will help you out.

    Sorry I did not quite understand what are you trying to achieve.
    Can you please describe me more so I can give you my suggestion.

    Thank you.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  2
    Martin replied

    Hi,

    My table has a number of "properties"   '446 Central Road'  'Home 2'  'Home 3'.   Users will be filling in forms for each home which will be writing rows to the same table.   

    I am trying to group by 'property' and display only the latest row for EACH property in the same table.

    Is there a filter that would create a list of "dis-similar" properties and display only the last row for each?

    Thanks!


  •  1,708
    Miloš replied

    HI Martin,

    Unfortunately something like this is not possible with our plugin build in.
    We have some documentation about  filters and actions but unfortunately we do not have filter that will be useful for your requirements.

    But we can recommend this service for customizations: https://wpkraken.io/?tms-plugins (by this link they would know you come from us) - they do develop such custom solutions, could you please send your inquiry to them? They have a promo hourly rate of $29/hour currently.

    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables