With Enrico Arata’s help I was able to use html.
Here is the method that I used:
var query3 = "select subj_num, id_birthdate from ID where subj_num = ‘1814’ ";
var dataset = databaseManager.getDataSetByQuery(controller.getServerName(), query3, null, 999999999);
var col_count = 0;
var Field12_text = ‘
’ // starts the html string
for ( var i = 1 ; i <= dataset.getMaxRowIndex() ; i++ )
{
dataset.rowIndex = i;
globals.Field12_text += ‘'; // displays field_one and field_two
if (++col_count == 4)// max 4 values for each row of data
{
globals.Field12_text += ‘’;
col_count = 0;// new row of data
}
This example queries data via a Servoy relationship then presents the information in a global field defined as an HTML_AREA, horizontally.
In the example, track lap times are entered into a portal. Like this:
first name, 1st lap time, 2nd lap time, 3rd lap time, 4th lap time.
When you click the Make HTML button a method named setHTML is called. It looks like this:
var record = ''
var numberRelated = horizontalparent_to_horizontalchild.getSize()
var htmlTemp= '<html><table border="0" cellspacing="4" cellpadding="2"> <tr>' // starts the html string
htmlTemp += '<td><strong>First Name</td>' // sets the name row
for ( var i = 1 ; i <= numberRelated; i++ )
{
record = horizontalparent_to_horizontalchild.getRecord(i)
htmlTemp += '<td>'+ record.firstname + '</td>'
}
htmlTemp += '</tr>'
htmlTemp += '<td><strong>1st Lap</td>' // sets the 1st lap row
for ( var i = 1 ; i <= numberRelated; i++ )
{
record = horizontalparent_to_horizontalchild.getRecord(i)
htmlTemp += '<td>'+ record.firstlap + '</td>'
}
htmlTemp += '</tr>'
htmlTemp += '<td><strong>2nd Lap</td>' // sets the 2nd lap row
for ( var i = 1 ; i <= numberRelated; i++ )
{
record = horizontalparent_to_horizontalchild.getRecord(i)
htmlTemp += '<td>'+ record.secondlap + '</td>'
}
htmlTemp += '</tr>'
htmlTemp += '<td><strong>3rd Lap</td>' // sets the 3rd lap row
for ( var i = 1 ; i <= numberRelated; i++ )
{
record = horizontalparent_to_horizontalchild.getRecord(i)
htmlTemp += '<td>'+ record.thirdlap + '</td>'
}
htmlTemp += '</tr>'
htmlTemp += '<td><strong>4th Lap</td>' // sets the 4th lap row
for ( var i = 1 ; i <= numberRelated; i++ )
{
record = horizontalparent_to_horizontalchild.getRecord(i)
htmlTemp += '<td>'+ record.fourthlap + '</td>'
}
htmlTemp += '</tr></table></html>' // ends the html string
globals.raceResultsHTML=htmlTemp // sets the HTML to a global with DisplayType set to HTML_AREA
Afterwards, the data is shown in the global field like so:
First name
1st lap time
2nd lap time
3rd lap time
4th lap time