FORUMS


The Form Tools forums are no longer active, but the old posts have been archived here. Please see the Help page on how to get help / report issues.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Export Manager: Custom Table View
#8
(Jan 8th, 2012, 1:33 PM)Ben Wrote: I'm so sorry for the long response time. I'm just trying to wrap up some work before I leave the country at the end of this month, and everything else is falling by the wayside.

When I first read your post I thought "no problem!" but when I just tried putting together a working example today, I was surprised how tricky it was - not just tricky, actually: downright complicated! The default Smarty content in the Export Manager code is really too complex by half. I'll have to simplify it in future versions.

So what I ended up doing was writing a helper Smarty function that *significantly* simplifies the job for us. I'll include this in the next version of the module for anyone in a similar situation.

Anyway, here's how to get it all done.

First off, since you need such a specific format, start by piecing together the HTML that you need for a *single* outputted submission. Just leave blank spaces where you want the values to be outputted from the database. Your HTML would just contain the main table layout and labels. When I look at your desired output, it'll clearly take some fiddling just to get the markup right with all the appropriate rowspans / colspans etc.

Once that's ready, it's a matter of putting it into the Smarty template and pasting in the appropriate variable into each spot in the field.

Download the attached file and upload it to your [form tools]/modules/export_manager/smarty/ folder. After it's been added there, it will be available to be used in your own Export Types Smarty content that you enter in the Export Manager module.

Here's a simple example of how it works. Instead of the loop-within-loop that the default HTML / Printer-Friendly "Table Format" Export Type smarty content uses (which is complicated, but fast), this works differently. It loops through each submission, but display explicit field values based on their column names. So, you just pass in the unique database column name for the field, and it will output the appropriate value for the current submission at the spot.

Code:
{foreach from=$submissions item=submission}

 
 <table>
   <tr>
     <th>Submission ID:</th>
     <td>{display_field_by_colname col_name="submission_id"}</td>
     <th>Field #1</th>
     <td>{display_field_by_colname col_name="col_1"}</td>
   </tr>
   </table>

   <br />

{/foreach}

In my case, I have a field called "Field #1", which has a column name of "col_1".

What you need to do is copy your markup into the Smarty Export Type content field and replace the <table> in the example above. Then, any place you want a value outputted for a field, just call the function, specifying the field you want:

{display_field_by_colname col_name="XXXXXX"}

And that's pretty much it!

Let me know how it goes.

- Ben

Ben this has stopped working when I updated to FormTools 3.0.1 and Export Manager 3.0.5.  Are there any plans to update the script?

Thanks!

Paul
Reply


Messages In This Thread
Export Manager: Custom Table View - by heywood7 - Dec 29th, 2011, 2:08 PM
RE: Export Manager: Custom Table View - by Ben - Dec 31st, 2011, 12:24 PM
RE: Export Manager: Custom Table View - by heywood7 - Jan 2nd, 2012, 3:14 PM
RE: Export Manager: Custom Table View - by Ben - Jan 8th, 2012, 1:33 PM
RE: Export Manager: Custom Table View - by ttuhsc-library-user - May 10th, 2018, 5:50 AM
RE: Export Manager: Custom Table View - by dedy - Sep 10th, 2012, 2:55 PM
RE: Export Manager: Custom Table View - by jgold723 - Mar 27th, 2014, 9:30 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)