Hi all,
I have a student list (array) with infos : Student ID, Name, D.O.B,...How do I put it into table field? Does it have title header on each column and can we click on header to sort infos?
Kind regards
Tablefield
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Hi there,
Unfortunately the table field options in Rev are sadly lacking, and very limited.
This enhancement request on the QCC should give more information about what isn't included, that is desirable.
http://quality.runrev.com/qacenter/show_bug.cgi?id=670 (voting for it may help... I don't know. It is "assigned" status, but the target milestone is still "future")
At present a table field is really just an ordinary field with options to show grid lines (or not) at points in the "table" set by the "tabStops" property. Each "cell" is just an "item" in the line where the itemDelimiter is a tab.
To make a table you would need to set the tabStops to set the correct widths, and create the desired number of columns in the property inspector (unless you manipulate the cREVTable[maxcolumncount] by script).
To transfer data you would need to loop through the array and take each element and put it into the correct item of the correct line of the table (where items are separated by tab).
To sort by header requires an additional row above the table field which you would need to script appropriately to sort the field by type and direction of the clicked header item.
I have a "graphAndTableObjects" stack which was originally written for Metacard in 2000 by Tuviah Snyder and revised over the years to a version by Ken Simons in 2006. Available here http://www.rpi.edu/~simonk/technical.html
Unfortunately the table field options in Rev are sadly lacking, and very limited.
This enhancement request on the QCC should give more information about what isn't included, that is desirable.
http://quality.runrev.com/qacenter/show_bug.cgi?id=670 (voting for it may help... I don't know. It is "assigned" status, but the target milestone is still "future")
At present a table field is really just an ordinary field with options to show grid lines (or not) at points in the "table" set by the "tabStops" property. Each "cell" is just an "item" in the line where the itemDelimiter is a tab.
To make a table you would need to set the tabStops to set the correct widths, and create the desired number of columns in the property inspector (unless you manipulate the cREVTable[maxcolumncount] by script).
To transfer data you would need to loop through the array and take each element and put it into the correct item of the correct line of the table (where items are separated by tab).
To sort by header requires an additional row above the table field which you would need to script appropriately to sort the field by type and direction of the clicked header item.
I have a "graphAndTableObjects" stack which was originally written for Metacard in 2000 by Tuviah Snyder and revised over the years to a version by Ken Simons in 2006. Available here http://www.rpi.edu/~simonk/technical.html
Hi SparkOut
First, I would like to thank for your help. I've also downloaded your example from the link but I'm beginner with RunRev so there are a lot things in it, I can't control.
Please help with simple thing. I want to create table field with X columns and Y rows. And I want to fill the table with Student list (as mentioned above). How can I do it?
Thanks so much
First, I would like to thank for your help. I've also downloaded your example from the link but I'm beginner with RunRev so there are a lot things in it, I can't control.
Please help with simple thing. I want to create table field with X columns and Y rows. And I want to fill the table with Student list (as mentioned above). How can I do it?
Thanks so much
Hi again,
I typed a long reply only to have the forum log me out before submitting and it lost my message - I think I remember much of what I said before.
Can you give a sample of dummy student data in the array you have? A lot will depend on the way you have set up your keys.
For example if you have:
That should populate the table - but you will probably need to sort the keys for the elements, and sort the id keys before you build up the data, otherwise you will not have the right information in the right places. This isn't a real world example.
The data can be placed more directly in the table field if you know where it is to go.
So some combination of looping by number and identifying the keys in order may be appropriate. It depends on how you have your array keyed.
To make a table you can drag it from the tools palette. To set the column widths, you use tabstops. In the table dropdown in the property inspector, you can specify the column widths in "tabstops" - so for example if you wanted column 1 to be the id and 40 px wide, column 2 to be the name and 160 px wide, column 3 to be the date of birth and 80 px wide, and column 4 to be the course and 200 px wide you would set the tabstops to: 40,200,280,480. Any column beyond the last will have the same tabstop width ad infinitum. Therefore for this example, you can set the maximum editable column to be 4. (Although that is so difficult to use cleanly, and is completely ignored if you use tab inside the field that it is safest to take out the cell editing option, and lock the text on the basic properties pane of the property inspector, only editing by script). If you adjust the width of the table field to match the right columns on screen then that is easiest, if you need to scroll horizontally you will need to set the end position of the scrollbar to the right value so that it scrolls only the amount you want visible.
If you have the horizontal grid lines shown, then they will be displayed to fill up the size of the table field regardless of whether rows are empty at the end of the table. Therefore you cannot set a table field to be "9 columns wide x 20 rows high".
In other words, please everyone go and vote for the table control enhancement in the QCC linked above - Rev is really let down by its native table handling capabilities.
I typed a long reply only to have the forum log me out before submitting and it lost my message - I think I remember much of what I said before.
Can you give a sample of dummy student data in the array you have? A lot will depend on the way you have set up your keys.
For example if you have:
Code: Select all
repeat for each line tStudentKey in the keys of tStudents
put tStudentKey & tab after tStudentInfo
repeat for each line tKey in the keys of tStudents[tStudentKey]
put tStudents[tStudentKey][tKey] & tab after tStudentInfo
end repeat
put cr after tStudentInfo
end repeat
put tStudentInfo into field "tblStudents"
The data can be placed more directly in the table field if you know where it is to go.
Code: Select all
set the itemDelimiter to tab
-- the "table" is simply a field with items separated by tabs
put "some data" into item 4 of line 7 of field "tblStudents"
To make a table you can drag it from the tools palette. To set the column widths, you use tabstops. In the table dropdown in the property inspector, you can specify the column widths in "tabstops" - so for example if you wanted column 1 to be the id and 40 px wide, column 2 to be the name and 160 px wide, column 3 to be the date of birth and 80 px wide, and column 4 to be the course and 200 px wide you would set the tabstops to: 40,200,280,480. Any column beyond the last will have the same tabstop width ad infinitum. Therefore for this example, you can set the maximum editable column to be 4. (Although that is so difficult to use cleanly, and is completely ignored if you use tab inside the field that it is safest to take out the cell editing option, and lock the text on the basic properties pane of the property inspector, only editing by script). If you adjust the width of the table field to match the right columns on screen then that is easiest, if you need to scroll horizontally you will need to set the end position of the scrollbar to the right value so that it scrolls only the amount you want visible.
If you have the horizontal grid lines shown, then they will be displayed to fill up the size of the table field regardless of whether rows are empty at the end of the table. Therefore you cannot set a table field to be "9 columns wide x 20 rows high".
In other words, please everyone go and vote for the table control enhancement in the QCC linked above - Rev is really let down by its native table handling capabilities.