Support » Plugin: WP Data Access » Random Rows, Truncating, Styling and Other Questions

  • Resolved timsilva2

    (@timsilva2)


    Hi Peter,

    Love your plugin. Just upgraded to the lifetime premium version. Here are a few things that it would be nice if you can help me (and others) do to enhance your already excellent product.

    1. Currently the front-end table defaults to 10 rows, starting with the 1st row of the DB table. How can I have the table start with a random row instead? That way google index won’t consider the site pages of a similar content?
    2. How can I limit search to exact match, so a search for “Part” won’t bring up “apartments” or “partition” or “party”?
    3. Can the search box pre-populate a grayed example search, such as “ex: Pets”?
    4. How can I truncate the content so that the content of each cell won’t exceed a certain number of characters? Say 100, and have it ends with an ellipsis? Even better if the user could expand to full content by clicking on a “expand” link.
    5. Where should I go to translate words such as “Showing” “entries” “Search”, etc. to another language?
    6. Is there a way for me to style the table independently of the WP page styling?

    Thanks Peter. Sorry for having so many questions.

    Tim

Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    Thank you for purchasing the premium version! 🙂

    There are three tools which can be used on the front-end:
    (1) Data Publisher
    (2) Data Forms (since you are a premium user)
    (3) Shortcode wpdadiehard

    Configuration is different per tool. To which tool is your question related?

    Thanks,
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Good morning Peter. In Data Publisher, after properly setting it up, I get a very nice html table that shows in almost every page in the site. This html table has some default values (before any search is done): 10 rows and the first row of the html table is the first row of the database table. How can I have the default first row NOT to be always the first row of the DB table, but a random row instead? The 2nd, 3rd, 4th… rows can be the sequence to the first row, that’s ok. BTW, I have avery large DB table (over 30,000 rows). I hope I made it clearer now. haha

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    Sorry for my late reply! Is has been a busy weekend.

    >>> How can I have the default first row NOT to be always the first row of the DB table, but a random row instead?

    Have your tried:
    order by rand()

    You can add this as a default order by to your publication.

    This will order your table differently on every request. But also your next and previous pages… 😊 Unless you load the whole table at once. Do you need all the 30.000+ rows? You can disable server processing…

    Let me know,
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Morning Peter,

    Thanks for the reply. When I tried 1,rand() I get “No matching records found”. 1,desc or 1,asc works, but not 1,rand(). I’m sure I’m missing something. 🙁

    Thread Starter timsilva2

    (@timsilva2)

    Hi Peter. Just to give you as much info as possible, I thought that maybe the problem was that my table didn’t have a numerical column, so I am now using a table that has a sequential number as first column. Still, 1,rand() does not work. Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    You’re right! Sorry, I missed that. It is not possible to use a function in the default order by of the Data Publisher. As a workaround you can create a view and use the view instead of the table. That works. I tested it. You can still allow users to change the order! 🙂 I did not expect that to work but it does.

    BTW, if you have added some table settings you’ll need to add them to your view as well. There is no inheritance.

    Let me know… 🙂
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Good morning Peter,

    Sorry, but I’ll need more guidance about this: “you can create a view and use the view instead”. I searched in documentation and couldn’t find any info on how to “create a view”. Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Sorry Tim! I was to fast… 🙈

    The plugin does not support gui help to create views. You need to write your own sql. For example:
    create view my_table_view as select * from my_table order by rand();

    Here are some more examples and explanations:
    https://www.w3schools.com/sql/sql_view.asp

    If you save this line (+ one empty line) in a file with extension .sql you can run that sql file from the Data Explorer (button Execute Scripts).

    Does this help?
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Hi Peter,

    I was able to create the view mentioned above in Data Explorer but I had to remove the empty line or would get erros.

    create view [my view] as
    select * from my_table
    order by rand();

    Now, how do I use the view in the front end, so visitors can see a table with different content (random) rows every time the page is refreshed?

    Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    Good work! 😊

    Open the Data Publisher, create a new publication and select your view from the table name list (I see I need to change that). After that you can do anything with your view you can do with a table.

    Let me know…
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Morning Peter.

    Random did work with the table view, as you mentioned. I couldn’t import the view directly in the plugin though and had to do so in the phpmyadmin. It works now.

    Where should I go to translate the word “SHOW MORE” and “Search:” to another language?

    Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    Great! 😊 Good to know: I released an update this morning. You can now create views directly in the Query Browser! 😊

    Please follow this link for the documentation to change the info message:
    https://wpdataaccess.com/docs/documentation/data-publisher/large-tables-and-performance/#enable-show-more-button

    Best regards,
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Hi Peter,

    The instruction in the link does not seem to apply for the big “SHOW MORE” button or the “Search:” at the top of the table. Where can I change those? Thanks

    Plugin Author Passionate Programmer Peter

    (@peterschulznl)

    Hi Tim,

    Sorry,totally missed that! 🙈 I will add a new options to the Data Publisher in the next update. As a temporary work around you could use the initComplete in the advanced table options to change the button label. Here is the code for it:

    { "initComplete": "function(settings, json) { jQuery('.wpda_more_button').text('SHOW MORE...') }" }

    Best regards,
    Peter

    Thread Starter timsilva2

    (@timsilva2)

    Thanks Peter,

    Now all that I have to translate is the word “Search” next to the search box. Can you please tell me how to do that?

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Random Rows, Truncating, Styling and Other Questions’ is closed to new replies.