Building data base aps with Rev (Jan Schenkel)

Jan Schenkel janschenkel at yahoo.com
Wed May 21 12:46:01 EDT 2003


--- Sadhunathan Nadesan <sadhu at castandcrew.com> wrote:
> 
> Hi Jan,
> 
> Wow, I really appreciate all the time you are
> putting into these posts,
> and unfortunately I am such a newbie that a lot of
> it is going over
> my head.  But I'm trying to follow it!
> 

Don't worry about it, Sadhu ; like I said, it's not
for the faint-hearted :-)

> Here are some of the things I am running into if you
> have time to respond,
> 
> 1) I can't find a "table object". 
> 
> [snip]
> 
> I was wondering the same thing about a 'portal'
> field from your
> previous post, is that actually a field type, or was
> I taking things
> too literally?  I'm trying to follow your
> instructions like a cookbook
> recipie and struggling.  
> 

What I meant with both these terms was: a field that
has 'table' functionality, and serves as a 'portal'
between the master record and the corresponding detail
records.
- to give a field 'table' functionality: open the
property inspector, go to the 'table' panel, and check
the 'Table object' checkbox
- use the 'database' panel to link this field to a
query, and you'll see that it displays all the records
in the cursor, not just the current record

> 
> 2) Using the query builder, there is very little doc
> on it so having
> trouble.  I am going to pass on to support that When
> I enter a query
> with a snytax error it crashes Rev.  What I was
> trying to do was put the
> contents of a card's field into a query as a
> parameter?  Maybe you have
> to script to do that, could probably figure that out
> but was hoping to
> do it in the builder,
> 
> such as, select * from foo where foo.bar = field
> "one"
> 
> Obviously the above isn't going to work.
> 
> Maybe it should be $l or [fld 1] or something. ??
> 
> The goal is to link 2 tables. The first table is
> returned by a query
> on it, filling up one set of fields.  I want the
> query for the second
> table to refer to a result from the first query, so
> as to fill up the
> matching fields for the second table.  ie, the
> equivalent to
> 
> select bar.a, bar.b, bar.c from foo, bar where
> foo.bar = bar.bar and
> foo.bar = field "one"
> 
> Can the query manager handle this sort of thing? 
> Well, again if not,
> the scripting approach as you lay out could .
> 

Unfortunatelyt, the query manager is not that advanced
(yet) -- you'll have to employ the trick I described
yesterday whereby you dynamically change the SQL of
the 'detail' queries.

> 3) Well as per your disclaimer, the functions in
> this and your
> previous post do not seem to be in the published
> API.  I tried some
> of them yesterday in the message box to see if they
> might do something
> but nothing happened.  Maybe I don't have them?
> 

You should have them, but they're actually in the
'revDatabase' frontScript, so they only work when
wrapped within a 'send' command (the frontScript will
intercept these).

> 4) I realize this is a lot to ask but I was
> wondering if you actually have
> a working stack on some kind of a data base with two
> tables that are
> related by a foreign key?  If so, could you send it
> to me?  Of course
> remove the specific connection info ..  gee I think
> passwords should be
> encrpted in the builder .. then I could either
> create a postgres database
> to match your schema or, change the table names etc
> to match mine.

Tuviah Snyder made an example stack for RunRev 1.1.1
-- so it doesn't use the nifty new features yet,
unfortunately. Here's a direct link :
http://www.runrev.com/revolution/downloads/developerdownloads/DB%20Examples.zip

I'll see if I can whip up an example stack with a
simple master-detail form ; for some reason my last
test stack, which ran perfectly fine yesterday, is now
complaining like mad ; must have something to do with
my version of MySQL (3.23.49) ; I know it's very picky
about cursors that aren't closed asap.

> 
> Sorry to be such a pain but I'm not quite getting
> it.
> 
> As an example, I launched a stack with a live data
> base
> connection and then tried the first function call in
> your
> example, I put this in the message box
> 
>  put the cREVDatabase["queryobject"] of fld 1
> 
> 
> I got - script compile error, error description -
> handler
> bad command
> 
> does that mean that "queryobject" was suppose to
> refer
> to something else, it wasn't to be taken literally,
> or does it mean,  I do not have this function,
> or????
> 
> Again, many thanks
> 
> Sadhu
> 

My apologies for not being clearer ; perhaps Tuviah
can jump in and correct me where I'm going astray ; I
have to admit that I'm used to scripting every single
call to the revdb functions ; however, I love to play
with new things and dig around.

Jan Schenkel.

=====
"As we grow older, we grow both wiser and more foolish at the same time."  (La Rochefoucauld)

__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com



More information about the use-livecode mailing list