I am currently using NinjaTables, and have the same issue.
I have a list of a million stock quotes, and need to filter it by say company name. If I apply a filter to the dataset, it is still requesting a million rows, and of course that takes time.
I have seen a charting tool that substitues variables into the sql so it only returns 1000 rows and not a million.
If you can try to clarify a bit more about that, and I will escalate this with our 2nd level Team since they have more experience, so they might understand it better than me.
but combining these two or perhaps even just by using that hook/filter,
you might be able to achieve this use-case.
We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet, so at this time you can only try to make a custom solution to make this work.
I hope this helps.
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Is it possible to populate an SQL placeholder with a URL parameter?
Hi, Murray.
Generally speaking, we have these Placeholders which you can use to make your SQL Query dynamic with our SQL Tables.
You can see more details how they work here.
But i did not fully understand your specific use-case.
Could you please elaborate a bit more,
if you can add any screenshots or a Video that might clarify what you are trying to achieve?
If it contains any sensitive data, please send it as PRIVATE reply, so that only we can see it.
Thank you.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
Hi Miloš ,
thanks for the reply.
My understanding is that you embed a placeholder in a SQL query:
SELECT * FROM my_table
WHERE my_field > %VAR1%
Then provide the execution value in the shortcode:
[wpdatatable id=12 var1=150]
However, this is hardcoded, what I want to do is extract the variable from the source url for the page:
https://mywebsite.com/?var1=150
Can this be done?
Regards,
Murray
Hi, Murray.
it is not possible to achieve this through the SQL Query exactly as you described.
Did you try our feature to Pre-filter tables through URL, as a possible alternate solution?
For example, you can try to add the placeholder %VAR1% as predefined filter value to your column which will be used for this filter.
If I have this table, and I wish to define an URL Parameter that will filter the "total" column for the number 150,
I will add this to the URL of my front-end page of the table :
In my table, I do not have any cell with 150 , though, so just as a demonstration, I will use "6,11" since that is in one of my table cells.
In the brackets for the column name, you can either use the column name, or the index number of the column,
you can see more about that in the Documentation link I sent.
-
If this solution is not suitable,
and if you need to use placeholder through the SQL Query,
could you elaborate a bit more on why you need this method for your use-case,
rather than adding VAR1 as predefined filter value for your column,
and then doing the method as you described , such as :
SELECT * FROM my_table WHERE my_field > %VAR1%
Then provide the execution value in the shortcode:
[wpdatatable id=12 var1=150]
I did not fully understand the use-case, so if you can elaborate and we will advise what might be the best approach.
Thank you.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
I am currently using NinjaTables, and have the same issue.
I have a list of a million stock quotes, and need to filter it by say company name. If I apply a filter to the dataset, it is still requesting a million rows, and of course that takes time.
I have seen a charting tool that substitues variables into the sql so it only returns 1000 rows and not a million.
This would be a great feature for large datasets.
Hi, Murray.
I think i can understand better what you need now , at least in regards to filtering a larger data set.
Basically, as you said - if we apply a filter to a table which already loaded a lot of rows from the SQL Database,
it does take longer than if we apply the filter in the SQL Query itself,
then our plugin will load less rows to begin with from the Query.
If you just need to filter a String Column with our VAR placeholder,
for strings , the Placeholder ‘variable’ %VAR1% should be surrounded with Single Quotes ( ‘ ) in the query,
as we pointed out in this Documentation.
Then, in the table's Placeholders, you can place a default value for the VAR1 for table generation,
and later, you can change it to any other value through the table's shortcode ( if needed).
But I am still not understanding what you meant when you wrote this :
"This is hardcoded, what I want to do is extract the variable from the source url for the page:
https://mywebsite.com/?var1=150 "
If you can try to clarify a bit more about that, and I will escalate this with our 2nd level Team since they have more experience, so they might understand it better than me.
Thank you.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
Hi,
"and later, you can change it to any other value through the table's shortcode ( if needed)."
This means I need to edit the page to change the shortcode/VAR1. I want to change VAR1 dynamically from a parameter in the url.
Does that make sense?
Regards,
Murray
Hi, Murray.
Sorry for the waiting time.
Thank you for adding more details about your use-case and what you're trying to achieve.
I think this will not be possible with our current plugin's capabilities,
but we are double-checking if our developers know any workaround to achieve it.
As soon as they advise, we will report back right away.
Thank you again for your patience.
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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
Hi Murray,
Thank you for your patience.
We got advised by our devs on this.
You can take a look at our available filters for developers here ;
https://wpdatatables.com/documentation/information-for-developers/filters/
-
They pointed out this one :
wpdatatables_filter_mysql_query( $query, $tableId )
because you can use that to manipulate the Query.
There is also an option with Placeholders,
but combining these two or perhaps even just by using that hook/filter,
you might be able to achieve this use-case.
We do like to give examples for certain solutions, but for this use-case, we, unfortunately, don't have anything yet, so at this time you can only try to make a custom solution to make this work.
I hope this helps.
And i just wanted to point out that you can try wpDataTables before purchasing
on our sandbox Demo sites ( you can find links for the main plugin Demo,
as well as add-on Demos, in my signature),
and there is a 15-day money-back guarantee period,
so if you purchase the plugin, you can safely fully test it out, and if it doesn't fit your needs you can request and receive a refund in that period. ( same goes for all plugins and add-ons)
Kind Regards,
Miloš Jovanović
[email protected]
Rate my support
wpDataTables: FAQ | Facebook | Twitter | Instagram | Front-end and back-end demo | Docs
Amelia: FAQ | Facebook | Twitter | Instagram | Amelia 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