Building data base aps with Rev

Sadhunathan Nadesan sadhu at
Fri May 16 12:23:00 EDT 2003


You folks may know that my thing is building data base applications,
and I'm searching for good tools for our company's next generation
of Internet enabled aps.  Consequently dabbling with Revolution, but
consider myself a newbie.

So anyway, I'd like to see tools for building generic screens and such,
but in absence of those, I'm looking for code examples.  Anyone have a
suggestion for me?


I think it should be possible to write some kind of generic function
to populate a screen (card) for one record in the data base.  Meaning,
if you have a card that has a field for each corresponding field in
a data base table (card field number matches data base field number),
then this function would loop through all the fields, query the data
base and populate the fields.  Or maybe there is an easier way.

Basically it's the kind of code you'd have to write over and over if
there is not a tool for it or some generic routines to call.  For
example, with Unify's NXj, let's say I want an html screen for an
Oracle table, I can just click a button for "build default screen
form" and bingo, it's all coded for me in Java and jsp pages.

I figure though I'll have to hand code it in Rev.  True?

So anyone know of an example or something like that??

To perhaps give a better idea of what I mean, below is a PHP code snippet
that - given the results of a generic query like 'select * from foo'
will build an html table of the results.  Not exactly the same since
what I want to do is a loop that will populate a static form, a card, and
clone the card for each row returned from the query, but it illustrates
the idea of building code that would work for any kind of db table.

I'm fervently hoping there are others on this list with the same

And thank you in advance.


// create table from pg_query results
function table_create($result)
     $numrows = pg_num_rows($result);
     $fnum = pg_num_fields($result);

     echo "<table border width='100%'>";
     echo "<tr>";

     for ($x = 0; $x < $fnum; $x++) {
	  echo "<td><b>";
	  echo strtoupper(pg_field_name($result, $x));
	  echo "</b></td>";

     echo "</tr>";

     for ($i = 0; $i < $numrows; $i++) {
	  $row = pg_fetch_object($result, $i);
	  echo "<tr align='center'>";
	  for ($x = 0; $x < $fnum; $x++) {
	       $fieldname = pg_field_name($result, $x);
	       echo "<td>";
	       echo $row->$fieldname;
	       echo "</td>";
     echo "</table>";

     return 0;

More information about the use-livecode mailing list