Field Value above CustomTemplate Table Header

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
fawks124
User
Posts: 3

Field Value above CustomTemplate Table Header

Post by fawks124 »

I've made a custom view named asset_monthly_report that uses two date ranges to calculate overlapping days in my ticketing system. I'd love to put one of the date ranges above my table so that users can have all the information without that date range redundancy (i.e. showing the range start and end on every row of data).

To put it grahpically, this is what I want (where line 1 is above the table headers, line 2 contains field headers, 3+ contain field values):

  1. ________FROM: (value of date 1) TO: (value of date 2)___________
  2. ASSET | OVERLAP
  3. (row 1 data)
  4. (row 2 data)

What I get when I try to put the value of a field above the headers, though, is this one line 1:

________FROM: #tpx_asset_monthly_report_DateS TO: #tpx_asset_monthly_report_DateE________

This is what I have to try to accomplish that:
In CustomTemplateHeader:

<h4 align="center">FROM: {{{value DateS}}} TO: {{{value DateE}}}</h4>
<table cellspacing="0" class="ewTable ewTableSeparate">
<thead>
<tr>
{{{list_options}}}<td>{{{Asset}}}</td><td>{{{Overlap}}}</td>
</td>
</tr>
</thead>

In CustomTemplateBody:
<tbody>
<tr{{{row_attrs}}}>
{{{list_options}}}<td>{{{Asset}}}</td><td>{{{Overlap}}}</td>
</tr>
</tbody>
</table>

Is there a way to put the value of a field above the headers of a table? What am I doing wrong here? Any help would be greatly appreciated!


danielc
User
Posts: 1601

Post by danielc »

There are no field values in CustomTemplateHeader yet. If you want to put field value not in CustomTemplateBody, you may consider to use Page_DataRendering server event to put your string into header. See Server event and Client script in help file.

If the DateS and DateE are the same for all the records in the page in your case, you can also consider outputting the field values by PHP in the template directly, e.g.

<?php echo CurrentPage()->DataS->ViewValue ?>


bobmulder5555
User
Posts: 60

Post by bobmulder5555 »

Brilliant, thank you! You solved my challenge in one go and preventing having to hard-code the column headers. (after hours and hours of fruitless tryouts). As different usertypes will be able to have a preference in which order they want to see the columns, display the value column header was the only way to go.

Just for people who are looking at a solution for this, I've used danielc's as solution:

<?php echo CurrentPage()->DataS->ViewValue ?>

Thanks again.


Post Reply