I am looking to see if you can guide me on the best way to work with advanced custom field repeaters. I got my query to work but the ACF repeater has a weird way of counting the rows
goal_items_%_goal_name
The percent is where it counts the number. I have been trying to get just the number so I can group the information into one row.
When I make the table it won't group onto one row it waterfalls and has each new field on a different row. I used the conditions in the wpdatatables and changed all the field keys to the corresponding number but that seems to change after the table posts so the grouping on that column is skipped.
I have also tried re-making all the fields as a group in a repeater but seem to be getting a similar response.
I tried a function to pull just the number but the function doesn't seem to work with wpdatatables.
Any suggestions on how can make this work are very welcome :)
SELECT wp4n_usermeta.`user_id`, wp4n_users.`ID`, IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_goal_name', wp4n_usermeta.`meta_value`, NULL) AS goal_name, IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_gravity', wp4n_usermeta.`meta_value`, NULL) AS goal_gravity, IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_urgency', wp4n_usermeta.`meta_value`, NULL) AS goal_urgency, IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_tendency', wp4n_usermeta.`meta_value`, NULL) AS goal_tendency, IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_why', wp4n_usermeta.`meta_value`, NULL) AS goal_why, IF(wp4n_usermeta.`meta_key` LIKE 'goal_item2_%_guty_total', wp4n_usermeta.`meta_value`, NULL) AS guty_total,
wp4n_usermeta.`meta_key`
FROM wp4n_users LEFT JOIN wp4n_usermeta ON wp4n_users.`ID` = wp4n_usermeta.`user_id`
WHERE user_id = %CURRENT_USER_ID% AND ( meta_key = 'goal_items' OR meta_key LIKE 'goal_items_%_goal_name' OR meta_key LIKE 'goal_items_%_gravity' OR meta_key LIKE 'goal_items_%_urgency' OR meta_key LIKE 'goal_items_%_tendency' OR meta_key LIKE 'goal_items_%_why' OR meta_key LIKE 'goal_items_%_guty_total')
***** THIS IS RETURNED *****
The names and numbers align with the proper columns but I want them to all be on the same row as the goal name. This table will then repeat this same thing for the next goal in the table.
1 1 cnbfgn rfgnh rtgnj hr goal_items_0_goal_name
1 1 2 goal_items_0_gravity
1 1 8 goal_items_0_guty_total
1 1 2 goal_items_0_tendency
1 1 1 goal_items_0_urgency
1 1 2 goal_items_0_why
The end result is to group this so it's on one row. I am having trouble with the number I could group on being in the middle of different strings. I can change the table conditions to look for contains _0_ and convert to 0 or _1_ to 1 but that change happens after the table generates so the grouping is skipped.
Row Grouping only works for non-server-side tables, so if this table has repeating data in a column, and if the table doesn't exceed 2.000 rows, you would be able to disable server-side processing and use that column as a grouping column.
If you're having issues with wpDataTables overwriting the changes you make in the query, it's most likely linked to the PHP SQL parser we use.
It has full support for the SQL dialect for the following statement types
Filtering, sorting, and search may not work properly if you include:
Accent graves ( ` ) around the table name
JOIN functions
UNION functions
CONCAT functions
sub-queries
You can try preparing a MySQL view (which will return the data that you need, call it e.g. “view1” and then build a wpDataTables based on a simple query like "SELECT * FROM view1″.
Thank you for the information! I decided to make a related CPT to make the charting easier for the data I want to give to the user. I am very happy with my purchase the documentation has been amazing, the support has been great and I really enjoyed looking around the wordpress sql database with the GUI tool.
Hi,
I am looking to see if you can guide me on the best way to work with advanced custom field repeaters. I got my query to work but the ACF repeater has a weird way of counting the rows
goal_items_%_goal_name
The percent is where it counts the number. I have been trying to get just the number so I can group the information into one row.
When I make the table it won't group onto one row it waterfalls and has each new field on a different row. I used the conditions in the wpdatatables and changed all the field keys to the corresponding number but that seems to change after the table posts so the grouping on that column is skipped.
I have also tried re-making all the fields as a group in a repeater but seem to be getting a similar response.
I tried a function to pull just the number but the function doesn't seem to work with wpdatatables.
Any suggestions on how can make this work are very welcome :)
SELECT wp4n_usermeta.`user_id`,
wp4n_users.`ID`,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_goal_name', wp4n_usermeta.`meta_value`, NULL) AS goal_name,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_gravity', wp4n_usermeta.`meta_value`, NULL) AS goal_gravity,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_urgency', wp4n_usermeta.`meta_value`, NULL) AS goal_urgency,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_tendency', wp4n_usermeta.`meta_value`, NULL) AS goal_tendency,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_items_%_why', wp4n_usermeta.`meta_value`, NULL) AS goal_why,
IF(wp4n_usermeta.`meta_key` LIKE 'goal_item2_%_guty_total', wp4n_usermeta.`meta_value`, NULL) AS guty_total,
wp4n_usermeta.`meta_key`
FROM wp4n_users
LEFT JOIN wp4n_usermeta
ON wp4n_users.`ID` = wp4n_usermeta.`user_id`
WHERE
user_id = %CURRENT_USER_ID% AND ( meta_key = 'goal_items' OR meta_key LIKE 'goal_items_%_goal_name' OR meta_key LIKE 'goal_items_%_gravity' OR meta_key LIKE 'goal_items_%_urgency' OR meta_key LIKE 'goal_items_%_tendency' OR meta_key LIKE 'goal_items_%_why' OR meta_key LIKE 'goal_items_%_guty_total')
***** THIS IS RETURNED *****
The names and numbers align with the proper columns but I want them to all be on the same row as the goal name. This table will then repeat this same thing for the next goal in the table.
1 1 cnbfgn rfgnh rtgnj hr goal_items_0_goal_name
1 1 2 goal_items_0_gravity
1 1 8 goal_items_0_guty_total
1 1 2 goal_items_0_tendency
1 1 1 goal_items_0_urgency
1 1 2 goal_items_0_why
The end result is to group this so it's on one row. I am having trouble with the number I could group on being in the middle of different strings. I can change the table conditions to look for contains _0_ and convert to 0 or _1_ to 1 but that change happens after the table generates so the grouping is skipped.
Hello Ryan.
Thank you for your purchase.
Row Grouping only works for non-server-side tables, so if this table has repeating data in a column, and if the table doesn't exceed 2.000 rows, you would be able to disable server-side processing and use that column as a grouping column.
If you're having issues with wpDataTables overwriting the changes you make in the query, it's most likely linked to the PHP SQL parser we use.
It has full support for the SQL dialect for the following statement types
SELECT, INSERT, UPDATE, DELETE, REPLACE, RENAME, SHOW, SET, DROP, CREATE INDEX, CREATE TABLE, EXPLAIN and DESCRIBE.
Some of them are disabled for security reasons.
Filtering, sorting, and search may not work properly if you include:
You can try preparing a MySQL view (which will return the data that you need, call it e.g. “view1” and then build a wpDataTables based on a simple query like "SELECT * FROM view1″.
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
Hi Aleksandar,
Thank you for the information! I decided to make a related CPT to make the charting easier for the data I want to give to the user. I am very happy with my purchase the documentation has been amazing, the support has been great and I really enjoyed looking around the wordpress sql database with the GUI tool.
I'm glad to hear that, Ryan.
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