mrc logo mrc logo
  • m-Power m-Power
    What is m-Power?
    Overview Demos Build Process Case Studies Specs Pricing Trial
    m-Power Resources
    Overview How-To Videos Webinars & Podcasts White Papers Fact Sheets
  • Solutions Solutions
    What does m-Power build?
    Overview Database Front-Ends Reporting CRM Systems Business Intelligence Dashboards Inventory Management Mobile Apps ERP Enhancements Modernization Spreadsheets to the web MS Access to the web B2B/Web Portals Scheduling Embedded Analytics Web Forms Workflow Data Exploration Budgeting & Forecasting APIs and Web Services Db2 Web Query Alternative
    Solutions by Industry
    Overview Manufacturing Government Foodservice Software Vendors Logistics & Supply Chain Software Consultants Healthcare
  • Services Services
    Development Services Training Mentoring
  • About About
    Overview Partners Press Releases Careers Events Contact Blog
  • Support Support
    Support Home FAQ Documentation Customer Portal Enhancements Updates Roadmap Techblog
Try m-Power

m-Power Manual

Browse:

  • Home
  • Freemarker
  • Control Row Layout with Freemarker
Back to Manual

Control Row Layout with Freemarker

 

There may be times when the standard look of a Multiple Record Retrieval may not work for you. For instance, let's say the row you want to print is relatively short (perhaps only one field), and there are many rows to display. Rather than having all the data in one column, you could use Freemarker logic to print some of that data into a second column. As an example, lets take a look at a list of 50 states. Here is a before picture:

 

As you can see, there is far too much wasted space. Instead, using Freemarker, we can have output that looks like this:

We are now able to utilize the screen much more efficiently. Let's walk through how this is done:

  1. After compiling your application, enter m-Painter and Toggle the source view.
  2. For simplicity, remove the Table Header, Advanced Search and Advanced Sort. Find <!-- BEGIN_TEXT_TABLE_HEADER --> and delete all the way to: <!--END_ADVANCED_SEARCH-->.
  3. To create a screen like the one above, we are going to use Freemarker to create looping logic in the HTML.
  4. Find this section of text (Beginning with the #list tag and going to the /#list tag):

<!-- <#list table_rows as row> -->

<tr>

<td class="${rowClass(row_index)}" nowrap="nowrap" align="left">

${row.FIELDNAME}

</td>

</tr>

<!-- </#list> -->

And replace it with this:

<tr><td> <table>

<!--<#assign counter=0>-->

<!-- <#list table_rows as row> -->

<!--<#if counter == 5> -->

</table></td><td><table>

<!--<#assign counter=0>-->

<!--</#if>-->

<tr><td class="even" nowrap="nowrap" align="left">

${row.FIELD}

</td></tr>

<!--<#assign counter=counter + 1>-->

<!-- </#list> -->

</table></td></tr>

Here is a review of the above text:

Line 1 — Create a nested row, data cell, and table.

Line 2 — Create a variable called counter, and set it equal to 0.

Line 3 — This is the default code that generates that tells the code to begin handling data from the DB

Line 4 — Immediately check to see if the code is equal to 5. This will never be the case until the code loops through 5 times. This number can be changed and will control the number of records printed per row.

Line 5 — If that was the 5th line, end the nested table and data cell. Immediately create a new one. This is what allows the tables to be placed on the same row.

Line 6 — Assign my counter variable back to 0 to start all over again.

Line 7 — End the if logic.

Line 8 — Start a new Table row and Table data cell. In this case my data cell will have a background of white for all cells.

Line 9 — Print the field. Please replace FIELD with the actual name of your field.

Line 10 — End the Table row and Table data created on Line 8.

Line 11 — Reassign the counter to add one to its current value.

Line 12 — End the looping control that began on Line 3. When this is reached, there are no more records to print.

Line 13 — End the nested table, Table Cell, and Table Row that began in Line 1.

Note: Your application, by default, will still only show 10 rows at a time. Please be sure to go into Application Properties and change the "max_rows" value accordingly.

Note: Be sure to change your field name from FIELD to your actual field name.

Created: September 11, 2008 | Modified: September 3, 2013

Search


Browse By Category

Build Process (13)
Starting with m-Power (8)
Retrievals (10)
Reports (15)
Summaries (4)
Maintainers (17)
Graphs (8)
m-Power Data Explorer (4)
General (24)
Calculations (5)
Utilities (9)
m-Power Administration (23)
Security (11)
Freemarker (6)
m-Painter (29)
Form Validation (5)
External Objects & UDFs (12)
Deprecated Documentation (23)
Bootstrap Templates (7)

Popular Tags

Compiling Summaries Maintainer Excel Admin Build Process RPG Video Administration Dates Dropdowns Security Tomcat Report External Objects Retrieval Graph Properties mrc-Productivity Series Graphing Bar Graphs Form Validation Prompt Screens Calculations Java Email SQL Parameters Bootstrap Templates Advanced Performance Data Dictionary Retrievals Popular Reports Freemarker Graphs Production DB2 App Properties Maintainers Getting Started m-Painter Application Properties Record Selections Database

See all tags »

michaels, ross & cole, ltd. (mrc)

Privacy Policy Cookie Policy Cookie Settings Notice at Collection Do Not Sell or Share My Personal Information

mrc (US)

2001 Midwest Road
Suite 310
Oak Brook, IL 60523
630-916-0662

mrc (UK)

Mortlake Business Centre
20 Mortlake High Street
London, SW14 8JN
+44-20-335-59566


© 2024 mrc. All rights reserved.