Open topic with navigation

Tools: Layout - Templates

Templates resource allows to include HTML files to be used in Headers, Footers and Custom Grids(User defined orientation). For example: billets, invoices, business cards, etc.


Figure1: Edit Templates Interface: Heading, Free Format and Footer.

 

It should be a HTML file. We can stipulate where Scriptcase fields will be displayed on the HTML file using "curly brackets" {variable}. As you can see below:

HTML Code
<table border="0" cellspacing="0" cellpadding="0">
      <tr>
                <td width="247" height="96" align="left" valign="center">
                <font face="verdana" style="font-size:11px">
                <b>{Name}</b><br>{Address}<br>{City}- {State}<br>
                {ZIP}
                </font>
                </td>
      </tr>
</table>

Running the HTML code above.
{Name}
{Address}
{City}-{State}
{ZIP}


Remember that everthing that comes insde curly brackets are making reference to the application fields, so when there is a {Name} it will be talking about the field "Name" of your application.

 

In the Template we can define a Loop feature using a flag (see in red):

Código HTML
<table border="0" cellspacing="0" cellpadding="0">
      <tr>
           <!-- BEGIN bl2 -->
                <td width="247" height="96" align="left" valign="center">
                <font face="verdana" style="font-size:11px">
                <b>{Name}</b><br>{Address}<br>{City}- {State}<br>
                {ZIP}
                </font>
                </td>
           <!-- END bl2 -->
      </tr>
</table>


The red parts define where the loop will start and finish. The iterations amount is defined by "Columns per Page" of the Grid.

eg: If "Columns per Page" is 3 so it will display the following result.

HTML code
<table border="0" cellspacing="0" cellpadding="0">
      <tr>
                <td width="247" height="96" align="left" valign="center">
                <font face="verdana" style="font-size:11px">
                <b>{Name}</b><br>{Address}<br>{City}- {State}<br>
                {ZIP}
                </font>
                </td>
                <td width="247" height="96" align="left" valign="center">
                <font face="verdana" style="font-size:11px">
                <b>{Name}</b><br>{Address}<br>{City}- {State}<br>
                {ZIP}
                </font>
                </td>
                <td width="247" height="96" align="left" valign="center">
                <font face="verdana" style="font-size:11px">
                <b>{Name}</b><br>{Address}<br>{City}- {State}<br>
                {ZIP}
                </font>
                </td>
      </tr>
</table>

Running the HTML Code above.

{Name}
{Address}
{City}-{State}
{ZIP}
{Name}
{Address}
{City}-{State}
{ZIP}
{Name}
{Address}
{City}-{State}
{ZIP}


Once ".html" file iscreated include it in Scriptcase accessing "Tools>>Layout>>Templates".

Select "Free Format" and Upload the file.

Then Create a new Grid application and select "User Defined" Option in "Orienation" setting.

Access "Grid>>Layout>>Settings" and select the "Body Template".

Now associate the template variables with the Grid fields. (Grid>>Select Fields)

Format the fields and Run.