Okay
  Public Ticket #2903315
data source wpDataTables using %VAR1%
Closed

Comments

  • Joseph Nickerson started the conversation

    My data source is a wpDataTables table that uses %VAR1% in a SQL query. The variable is passed & works in Data Tables, but when using the source in wpReportBuilder the export to MS Excel template doesn't populate. These all work correctly if I hard code instead of using %VAR1%. Is there anyway to populate the data source with the variable before wpReportBuilder uses it?

  •   Joseph Nickerson replied privately
  • [deleted] replied

    Hi Joseph

    Firstly, I would like to sincerely apologize for the delayed response as we have been experiencing an unusually high number of tickets. I am sorry that it has taken longer than usual to respond to your concern and your patience is highly appreciated.

    Can you please send us the template and the dump of the table so we can have a closer look at how it has been configured? 

    Any kind of report can use additional variables. You can define any number of additional variables at the moment of report creation, and reference them in the template. Please note if a variable will not be found in the incoming data, it is going to stay as is in the generated template: e.g. if you use ${myvar} variable in the template, but do not define it on WordPress site, it is going to stay ${myvar} in the generated reports.

    All reports can use default pre-defined variables (username, today’s date, etc.). See the full list here.


  • Joseph Nickerson replied

    Hi Blaženka,

     

    I’m not sure how to get you the template & dump of the table, but I ca explain further here. I have a wpDataTables table with this query:

     

    (see picture1 attached)

     

    Per some advice from wpDataTables I’m using this code in my functions.php of my theme:

     

    // Update var1 for wpDataTables

    function updateVAR1($tableID){

      global $wdtVar1;

          //check is set GET parametar value_x

        if(isset($_GET['value_x'])){

            //get value from form field

            $wdtVar1 = $_GET['value_x'];

        }

      }

    add_action('wpdatatables_before_get_table_metadata', 'updateVAR1');

     

    When I open the table is passes the “value_x” to %VAR1% and populates the table correctly:

     

    (see picture2 attached)

     

    My Report uses the same wpDataTable titled “6400 (id:17)” (see the first screen):

     

    (see picture3 attached)

     

     

    This is my WP Page:

     

    (see picture4 attached)

     

     

    But when I click “Download Report” to my template it’s missing all of the data from the table above.

     

    Hope this helps, let me know if I can send anything else.

     

    Thanks,

     

    Joe

  •  2,498
    Aleksandar replied

    Hello Joseph

    Thank you for the explanation, but without looking at the table and the report template, we can't say much about what's going on.

    Please send us the Excel or the Word file you're using as the template for the Report Builder add-on, and provide us with a temporary wp-admin user (administrator), so we can log in, and see what's going on.

    Make sure to tell us what's the report builder ID and the table ID, so we know where to look.

    Also, please note that this is a public ticket, so make sure to enable the PRIVATE response before you send us the credentials.

    Kind Regards, 

    Aleksandar Vuković
    [email protected]

    Rate my support

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia 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

  • Joseph Nickerson replied

    Hello Aleksandar,

    This site is local on a client server, and needs VPN to access, which I don't have the ability to give you. The best I can do is send you a Duplicator plugin backup of the site & database. Let me know if that will work and where to send it.

    Thanks,

    Joe


  • [deleted] replied

    Hi Joseph

    Yes, you can duplicate the website with Duplicator plugin . It will generate a couple of files that you can send us (along with the log-in credentials), and then we can create an exact copy of your website, see what the issue is and try to resolve it.

    The Duplicator plugin can export only up to 500MB of data, so if your site is bigger than that, please use the All-in-One WP Migration plugin.

    Please note that the files will be too large to attach to the ticket, so you can upload them via wetransfer.com and just send me the link.