As indicated in our documentation, using variables ( @ ), stored procedures and nested queries is not supported, but you can prepare a MySQL view (which will return the data you need); call it “view1” for example, and then build a wpDataTable based on a simple query like “SELECT * FROM view1”.
You can use a custom JS to add row numbers to the table:
it's okay but i need right numeration for downloading tables in excel files. how can i save this numeration for downloading table? after downloading in downloaded excel file i should have this right numeration
hello, i use wpdatatables plugin in my site and in some of tables i need to get row_number in sql code.
as mysql doesn't have possiblity to use row_number https://stackoverflow.com/questions/1895110/row-number-in-mysql then i use iterator sql code for getting it.
in phpmyadmin i have code and it works in phpmyadmin https://prnt.sc/10gzq6j but the same code doesn't work in wpdatatables editor https://prnt.sc/10gzm2x
pls tell me how can i solve this issue?
sql code:
SELECT
@i:=@i+1 AS 'iterator',
t1.*
FROM (
SELECT
1 AS '',
t.spacname,
t.industry,
t.common,
t.ipodate,
t.ipoproceeds,
t.overallotmentproceeds,
t.privateplacementsproceeds,
( t.ipoproceeds+t.overallotmentproceeds ) as 'total',
( ( ( t.ipoproceeds+t.overallotmentproceeds ) * t.heldintrust ) / 100 ) as 'total_gross',
t.heldintrust,
t.warrantsinclinunit,
COALESCE ( t.rights, '' ) as 'rights',
t.monthstocomplete as 'monthstocomplete',
( ( ( DATEDIFF( t.completiondeadlinedate, CURRENT_DATE() )) /30.42 ) ) as 'monthstoleft',
t.completiondeadlinedate as 'completiondeadlinedate',
SUBSTRING_INDEX( t.underwriter, ",", 1) as 'Left Lead / UW',
t.spactype,
t.heldintrustperunit,
t.warrant,
t.unit,
t.right,
t.underwriter,
t.additionalterms,
t.lawyerissuerscounsel,
t.underwritercounsel,
t.comanagers,
t.cashorcashlessredemption,
t.feesupfrontdeferred,
t.businesscombinationrecorddate,
t.businesscombinationshareholdervotedate,
COALESCE(t.impliedenterprisevalue, 0) as 'impliedenterprisevalue',
t.currentendingtrustbal as 'ending_trust_ball',
t.currentimpliedcashpershare as 'implied_cash_per_share',
t.singlespacsharetext,
t.singlespacexerciseprice,
t.singlespacredemptionprice,
t.completedsymbolwarrant,
t.completedsymbolcommon
FROM `ecwnyr4L_wpdatatable_1` t
WHERE t.spactype LIKE '%SEARCHING%'
ORDER BY t.ipodate DESC
) t1,
(SELECT @i:=0) AS foo
Hello Roman
As indicated in our documentation, using variables ( @ ), stored procedures and nested queries is not supported, but you can prepare a MySQL view (which will return the data you need); call it “view1” for example, and then build a wpDataTable based on a simple query like “SELECT * FROM view1”.
You can use a custom JS to add row numbers to the table:
Of course, you will use a table shortcode with an id that you need (in the example we use 1 )
Another way would be, as indicated above - to create a view in the database, and then create a table from that view.
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
it's okay but i need right numeration for downloading tables in excel files.
how can i save this numeration for downloading table?
after downloading in downloaded excel file i should have this right numeration
Hi again Roman
The column would be added to the table, so when you export the table in Excel format, that column will also be included. Does this not happen?
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
it doesn't work for exported excel file, is there any way on backend part to do it?
Hello again Roman
Unfortunately, no. The data needs to be in the table, not added through a JavaScript for the table tools to be able to print that data.
At the moment, there's no workaround to export IDs generated by this approach.
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