Okay
  Public Ticket #1431739
Report Builder - Variables Not Working
Closed

Comments

  •  1
    cattrack started the conversation

    I have created a very detailed template to work somewhat like the invoice template.  

    There was no documentation re: required layout of the query/wpdatatable.  I have some data that is repeated for each row that I am using ${variable} for each header level data element (like invoice number in the invoice example) and a table of detail level data using ${variable.all}. (like the product level detail in the invoice example).

    The detail level data populates correctly but the header level data is rendered with the ${variable}.

    I am attaching the template and the output.  What am I doing wrong?

  • [deleted] replied

    Hi Cattrack,

    If you want to add name of the column header please use ${variable.name}

    If you want to use data from the table outside of the table in the report you need to wrap it like

    ${wpDataTable.row} 
    Column1: ${column1.all} 
    Column2: ${column2.all
    ${/wpDataTable.row}

     

  •  1
    cattrack replied

    Hi Miljko - this is not how the invoice template example looks to be designed.  This is the design I followed.  It does not use any ${wpDataTable.row} wrappers.  It also seems like the .all would cause all records from column1 (i.e. invoice #) to be repeated, no?

    My data in the query using the invoice template as an example:

    invoice | customer | product | price

    1 | CUSTOMER A | PRODUCT 1 | $10

    1 | CUSTOMER A | PRODUCT 2 | $5

    2 | CUSTOMER A | PRODUCT 1 | $10

    3 | CUSTOMER B | PRODUCT 3 | $2

    3 | CUSTOMER B | PRODUCT 4 | $4

    3 | CUSTOMER B | PRODUCT 5 |  $5

    I want to show ${invoice} and ${customer} in the header and a detail table below with ${product.all} and ${price.all}.

  • [deleted] replied

    Hi cattrack,

    Problem with this approach is that our plugin has no way to know which variable to "group". Variable in form of ${customer} without extension like ".all" or ".name" need to be used with multifile report where our plugin generate separate file for every record in the table . 

    There is no way to have customer name which occurs multiple time in the customer column as one value and all other columns for that customer in for of the table. 

    You could for example prefilter table to show only one customer at the time shith filter like select box and then create a report which will have multiple invoices in it based on chosen customer, or maybe to leave customer name in the table and that way it will repeat for every row but it will be shown instead of variable.  

  •  1
    cattrack replied

    I am trying to understand how the example invoice template works then:  http://wpreportbuilder.com/wp-content/uploads/2016/04/word-invoice-purchases-table-1.docx

    It uses a combination of ${invoicenumber} and ${notes} in the header and a table with 

    ${product.all}

    ${quantity.all}

    ${price.all}

    ${formula_1.all}

    This is what I was attempting to duplicate using my data.


    If this is not possible, are there any workarounds? i.e. ${invoice.min} or wrapping in ${wpDataTable.row} but with the ability to limit it to a single row?

    We can instruct and/or force the report to be run only for a single invoice on the front end......

  • [deleted] replied

    Hi cattrack,

    In that particular template invoice and notes are added as additional variables which do not exists in data source table and are designed to be added later. You can find more information about additional variables in our - Documentation 

    Easiest way would be previously suggested pre filtering the table to show only one row at the time. Unfortunately there is no way to tell wpReportBuilder to use only distinct values from one column and use that for creating report

  •  1
    cattrack replied

    The invoice template is a bit misleading.

    Is this a planned feature in the future?  It seems like that would be a highly requested feature.

    For others who come across this, my workaround to resolve and allow "header" type information and "detail" information using the existing multi-file report was to pivot the detail data and limit my template to the top x detail records that I wanted to pivot.  So, I get a very wide table with all of the data I would like to show in a single report.

  • [deleted] replied

    Hi cattrack,

    We will take a closer look at your suggestion but, as I can see, it need to be designed really carefully because there are so many posible cases.