view the Portal fields in a horizontal format

Hi all,

Currently in Servoys Forms we can view the portals fields in Vertical format

Is there a way to view the Portal fields in a horizontal format?
Meaning instead of labeling the columns, could we label the rows?

Example:

First_name
Jim
Tom
Michelle

Change it to:
First_name: Jim Tom Michelle

Thanks in advance,

Abrahim

no that is currently not possible.
You have to create such a bean yourself

How about in Tab panel or any other way?

Abrahim

no it is dynamic so you can only do it with a special tablebean
OR
do it youreself in a html and show that html in a HTMLArea

Johan,

Thanks for the info.

Regards,

Abrahim

Abrahim,

I also need to display table data horizontally and would be interested in knowing how you decide to handle this.

Also, does anyone know of a “horizontal” tablebean?

Greg,

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
}

}
globals.Field12_text += ‘

’ + dataset[1] + ’
‘+dataset[2]+’
’ // closes the html string

Or check:

http://forum.servoy.com/viewtopic.php?p … ght=#17958

I hope that helped.

Regards,

Abrahim

Thank you both.

For Abrahim and Greg this may be a late arrival. Those wanting Servoy examples, I placed a very basic horizontal example on the web for your review.

It can be downloaded here.

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

Hope it helps.

You can do the same thing dynamically by using the code two posts above. That way it will work for however many rows you return.

Judy,

I’ll give it a try.

Thanks,

Abrahim

Judy,

After expanding the HTML, I see three folders:

  1. export
  2. export_sample_data
  3. META-INF

So, how can I make it to work?
Do I need to copy them into Servoy folder?
Please let me.

Thanks in advance,

Abrahim

Abrahim,

:? My name is Jody

The sample is a Servoy solution file. Don’t expand the file, just import it into your Servoy Repository.

Look up Repository, importing a solution in the online help in Servoy Developer located on the Help menu.

Jody,

Sorry for misspelling your name :(

Thanks for the solution, it was very helpful.

Best regards,

Abrahim

Abrahim,

No worries.

Glad I could help! :)