I need to create a table from a SQL query that prefilters the results based on a URL rather than in the shortcode. Is this possible? For example, I have a SQL query
select pin, address, town, comparison from rta_details where address like '%%VAR1%%' and address like '%%VAR2%%' and town = '%VAR3%'
I then went into the Placeholders tab and populated
%VAR1% with 213 %VAR2% with main %VAR3% with Rich
The preview works fine, and if I add the table to page with the shortcode including these variables, it works. What I need to do, however, is pass these values in the URL so that they are dynamic. I can't find the proper syntax for doing this.
My page with a Contact Form 7 form is https://residentialtaxappeal.com/test/ and I can pass the variables from the Street Number, Street Name and Township from that form, but I don't know the syntax to pass.
I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.
You see, we're using jQuery of datatables plugin, which has a specific structure that needs to be followed to create a table. Table description is being forwarded to the admin-ajax URL, and not a custom URL. That has been created to wrap table description within wpDataTables. At the moment we don't have this feature, but we will be working on including VAR as well, since it has been requested a few times already.
Good day. I was wondering if there is any updates on this, as it has been around a year. Last time we corresponded it seemed like this may be a future feature. Did it make the roadmap?
I'm not sure if this can be done with a workaround now, but I did forward the ticket to one of our developers. As soon as I hear from him, I will let you know.
We don't have this built-in yet, but you can with a workaround. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create a table with a query like this:
SELECT
user_id,
user_name,
user_address,
CONCAT('<a href="http:/yoursite.com/your_custom_page?user_id=',user_id,'">Details</a>') AS Details
FROM your_table_name
Then, on your_custom_page you will insert a shortcode of the table ID that you need, with a placeholder like this:
[wpdatatable id=1 var1=1]
The second table would be created from a query like this:
SELECT * FROM second_table WHERE user_id = %VAR1%
After that, you can use a hook for dynamic placeholders:
function updateVAR1($tableID){ global $wdtVar1; //check is set GET parametar user_id
if(isset($_GET['user_id'])){
//get value from form fieald
$wdtVar1 = $_GET['user_id'];
} }
add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');
I hope this helps you achieve the results that you need.
As mentioned before, we're using the jQuery of datatables plugin, which has a specific structure that needs to be followed to create a table. Table description is being forwarded to the admin-ajax URL, and not a custom URL. That has been created to wrap table description within wpDataTables.
At the moment, only the workaround posted in my previous response can be used. Our developers will work on this in the future, but it's not easy to implement a new feature like this, so other than developing it, we'll also have to go through thorough testing before it is released.
I was able to figure this out. We wrote some custom code to be able to dynamically pull from the table using a VAR as well as pass variables to the WHERE clause.
Hello Alexsandar, this feature is important to me. Where do we write the PHP code in your answer to And? Can you write in more detail? What I want to do is send the id from the url to SQL
The hooks (actions or filters) are usually added to themes or child themes, in the functions.php file, and what I sent to Andy is just an example.
Please note that using hooks requires coding skills and is not included in the provided support for the plugin. Other than sharing an example, I, unfortunately, can't provide any further assistance in this case.
I need to create a table from a SQL query that prefilters the results based on a URL rather than in the shortcode. Is this possible? For example, I have a SQL query
select pin, address, town, comparison from rta_details where address like '%%VAR1%%' and address like '%%VAR2%%' and town = '%VAR3%'
I then went into the Placeholders tab and populated
%VAR1% with 213
%VAR2% with main
%VAR3% with Rich
The preview works fine, and if I add the table to page with the shortcode including these variables, it works. What I need to do, however, is pass these values in the URL so that they are dynamic. I can't find the proper syntax for doing this.
My page with a Contact Form 7 form is https://residentialtaxappeal.com/test/ and I can pass the variables from the Street Number, Street Name and Township from that form, but I don't know the syntax to pass.
I've tried all sorts of things using ?wdt_search without any luck. For example, https://residentialtaxappeal.com/app-assessment-results-address/?wdt_search&wdt_var1=430&wdt_var2=Greenwood?wdt_var3=Maine
Is there a way to do this?
I forgot to add the attachment. Here it is.
Hello 64HTM
Thank you for your purchase.
I am sorry to disappoint you, but unfortunately something like this is not possible with the plugin's built-in features.
You see, we're using jQuery of datatables plugin, which has a specific structure that needs to be followed to create a table. Table description is being forwarded to the admin-ajax URL, and not a custom URL. That has been created to wrap table description within wpDataTables. At the moment we don't have this feature, but we will be working on including VAR as well, since it has been requested a few times already.
Sorry for the inconvenience.
Kind Regards,
Aleksandar Vuković
[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
Thank you for getting back to me. I appreciate the reply.
You're welcome, sir.
If you have any further questions or issues, please feel free to open a new ticket, and we'll gladly help.
Kind Regards,
Aleksandar Vuković
[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
Good day. I was wondering if there is any updates on this, as it has been around a year. Last time we corresponded it seemed like this may be a future feature. Did it make the roadmap?
Thanks in advance!
Hello Andy
I'm not sure if this can be done with a workaround now, but I did forward the ticket to one of our developers. As soon as I hear from him, I will let you know.
Kind Regards,
Aleksandar Vuković
[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
Hello again Andy
We don't have this built-in yet, but you can with a workaround. Please note that this does require some experience with writing SQL queries and using WP hooks.
You can create a table with a query like this:
Then, on your_custom_page you will insert a shortcode of the table ID that you need, with a placeholder like this:
[wpdatatable id=1 var1=1]
The second table would be created from a query like this:
After that, you can use a hook for dynamic placeholders:
I hope this helps you achieve the results that you need.
Kind Regards,
Aleksandar Vuković
[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
Is this feature available now? I also need this! I'm going to purchase. I will be happy if you have this feature! Why you postponing this?
Hello Kumar.
As mentioned before, we're using the jQuery of datatables plugin, which has a specific structure that needs to be followed to create a table. Table description is being forwarded to the admin-ajax URL, and not a custom URL. That has been created to wrap table description within wpDataTables.
At the moment, only the workaround posted in my previous response can be used. Our developers will work on this in the future, but it's not easy to implement a new feature like this, so other than developing it, we'll also have to go through thorough testing before it is released.
Kind Regards,
Aleksandar Vuković
[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 was able to figure this out. We wrote some custom code to be able to dynamically pull from the table using a VAR as well as pass variables to the WHERE clause.
Thanks All
Greetings, any update regarding this query please ? '"dynamic URL placeholders or passed in variables"
Sorry Zakaria, we have not yet implemented this.
Maybe Andy here can share his workaround so you can use it, but please feel free to add this to our feature suggestions page, so it's up for voting.
Kind Regards,
Aleksandar Vuković
[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
Hello Alexsandar, this feature is important to me. Where do we write the PHP code in your answer to And? Can you write in more detail? What I want to do is send the id from the url to SQL
Hello Engin.
Sorry for the late response.
The hooks (actions or filters) are usually added to themes or child themes, in the functions.php file, and what I sent to Andy is just an example.
Please note that using hooks requires coding skills and is not included in the provided support for the plugin. Other than sharing an example, I, unfortunately, can't provide any further assistance in this case.
Kind Regards,
Aleksandar Vuković
[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