Page 1 of 1
Loading a table field with data
Posted: Sun Jun 03, 2007 9:20 pm
by kpeters
While searching for info on how to fill a table field with data from a MySQL query I stumbled upon a post by Jan Schenkel from almost three years ago
refering to undocumented calls like:
revReadCellValue(tLongID,tColumn,tRow,tFormat)
revWriteCellValue tLongID,tColumn,tRow,tValue)
revUpdateDatabase tLongID,tColumn,tRow,tValue)
Is this the best info out there or has some real documentation been created?
TIA
Kai
Posted: Mon Jun 25, 2007 4:11 pm
by oliverk
Hi Kai,
Although these functions may work fine, I would recommend sticking to the fully supported and documented methods as we could change the semantics of any undocumented functions.
If you need to display data from a database table in a Revolution field, I would suggest taking a look at the revDataFromQuery function, which can provide formatted data suitable for putting straight into a field.
For example, lets say you have a table called "users" with the following description:
- id integer primary key
- firstname text
- lastname text
- approved boolean
Once you have connected to your database, you can retrieve the data from the table using a query like this:
Code: Select all
local tUserData
put revDataFromQuery(tab, return, sgDatabaseId, "SELECT id, firstname, lastname, approved FROM users") into tUserData
if item 1 of tUserData is "revdberr" then
-- Handle error here
end if
put tUserData into field "Users" of me
If your field is a table field, all you need to do is ensure that the data is formatted with each record on a new line and each column separated by a tab character.
You can easily manipulate the contents of the table field by using the item and line keywords and delimiters.
Hope this is some help.
Regards
Oliver