Hi folks,
I just wanted to leave a bit of support for others who may need to amend or create their very own SQL query using wpdatatables integration plugin.
For those who have purchased the plugin, this does offer the ability to build tables based on forms submitted and retrieving values based on the fields associated with the form.
i have paid a developer to write a query to do just this to get the same result, however i will supply the code for you to adapt to your needs.
My need was to create a specific filter based on the query which can also be done by the plugin but wanted to share the query if you choose to use it and make use of it.
select
max(case when fld.name = 'User ID' then mta.meta_value end) as 'User ID',
max(case when fld.name = 'IP Address' then mta.meta_value end) as 'IP Address',
max(case when fld.name = 'Server' then mta.meta_value end) as 'Server',
max(case when fld.name = 'Entry Time' then mta.meta_value end) as 'Entry Time',
max(case when fld.name = 'Entry Date' then mta.meta_value end) as 'Entry Date',
max(case when fld.name = 'Country' then mta.meta_value end) as 'Country',
from wp_frm_forms frm
inner join wp_frm_fields fld on (fld.form_id=frm.id)
inner join wp_frm_items itm on (itm.form_id=frm.id)
inner join wp_frm_item_metas mta on (mta.field_id=fld.id and mta.item_id=itm.id )
where frm.id=15;
you may want to add conditions to the query for your very own purposes but at least you can see the framework that you can easily edit.
replace all instances of field names to match your own such as 'User ID' both need to match like so and do this for each field you want to query
max(case when fld.name = 'Feild 1' then mta.meta_value end) as 'Field 1',
max(case when fld.name = 'Feild 2' then mta.meta_value end) as 'Field 2',
thanks Chris
One comment on “wpdatatables Integration With FormidablePro”
I wrote a sql query like this:
"select distinct i.id as id_prac,
(select mm.meta_value from wp_frm_item_metas mm where mm.field_id=407 and mm.item_id=m.item_id) as lastname,
(select mm.meta_value from wp_frm_item_metas mm where mm.field_id=408 and mm.item_id=m.item_id) as firstname
from wp_frm_items i, wp_frm_item_metas m
where i.id=m.item_id and i.form_id=34"