Building data base aps with Rev

Sannyasin Sivakatirswami katir at hindu.org
Mon May 19 16:19:01 EDT 2003


Jan, thanks for this ... it is just what one needs to get going...

If you don't mind a little more "brain drain":

e.g. if I select category

"cultural" in our on line dbase of organizations, i can (and have) 
returned those rows to a field. let's say, 20 records...

Now you want to have an interface that shows a single column only in 
each field on the card, one row at a time. Like an input form but, its 
serving as a record view and it contains one record only and you click 
next and it goes to the next one...

Is that doable with the current "point and click" tools? I couldn't 
find it.

Thanks for this help!

Sivakatirswami


On Sunday, May 18, 2003, at 03:33  AM, Jan Schenkel wrote:

> From: Jan Schenkel <janschenkel at yahoo.com>
> Date: Sun May 18, 2003  3:33:27  AM Pacific/Honolulu
> To: use-revolution at lists.runrev.com
> Subject: Re: Building data base aps with Rev
> Reply-To: use-revolution at lists.runrev.com
>
> --- Sadhunathan Nadesan <sadhu at castandcrew.com> wrote:
>> Greetings,
>>
>> 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?
>>
>> [snip]
>>
>> I'm fervently hoping there are others on this list
>> with the same
>> interest.
>>
>> And thank you in advance.
>>
>> Sadhu
>>
>
>
> Hi Sadhu,
>
> Off the top of my head there are two ways:
>
> 1) Check out the new Query Builder functionality,
> which allows you to store queries in a stack, and then
> 'hook up' buttons and fields
>
> - Create a new stack
>
> - Menu 'Tools' > Item 'Database Query Builder'
> - Click on the '+' button to create a new query
> - Give the query a name and fill in the connection
> parameters
> - Click on the 'Connect' button
> - Now go to the 'RecordSet' tab
> - Select a table, and tweak the SQL query
>     Ex: SELECT * FROM locations
> - Select the primary key field
>
> - Now place a field on the card
> - Open the 'Inspector' palette
> - Go to the 'Database' panel
> - Select the query you created earlier
> - Select the column you want to dsplay in that field
>     Ex: location
>
> - Make and link some more fields
>
> - Now place a button on the card
> - Open the 'Inspector' palette
> - Go to the 'Database' panel
> - Select the query you created earlier
> - Select the action you want to execute
>     Ex: Move to the next record
>
> - Make and link some more buttons to traverse the
> records in the query cursor.
>
> -> There you have it, without writing a single line of
> code, and you can even refresh and update records if
> you want to  *cheers*
>
> 2) If you're not afraid of scripting, and are just
> populating fields for display, you can do it even more
> quickly:
>
> on PopulateFields pConnectionID, pColumns, pTables,
> pCondition
>   -- asuming you have connected already
>   --  pConnectionID = the connection number
>   -- now let's make good use of the merge function
>   --  pColumns   = the column names
>   --  pTables    = the table(s) involved
>   --  pCondition = the content of the WHERE-clause
>   put merge("SELECT [[pColumns]] FROM [[pTables]]
> WHERE [[pCondition]] ;") into tSQLQuery
>   put revQueryDatabase(pConnectionID,tSQLQuery) into
> tCursor
>   if tCursor is not a number then answer tCursor
>   else
>     repeat with i = 1 to
> revDatabaseColumnCount(tCursor)
>       put revDatabaseColumnNumbered(i) into field i
>     end repeat
>   end if
> end PopulateFields
>
> Nice and simple, but you'll have more work to do if
> you want to update records in the database.
> Personally, I prefer to work with the column names,
> and that's just as easy to implement, and I like a bit
> of error checking as well :
>
>     put revDatabaseColumnNames() into tColumnNames
>     repeat for each item tColumnName in tColumnNames
>       if there is a field tColumnName then put \
>          revDatabaseColumnNamed(tColumnName) into \
>          field tColumnName
>     end repeat
>
> Hope this gets you going,
>
> Jan Schenkel.




More information about the use-livecode mailing list