Displaying Related Records

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am

Displaying Related Records

Post by arkstar » Tue Jan 19, 2010 10:40 am

I have a database that has several tables. One table is a list of clients. Another table is for events. My goal is when you have a client's record on the screen, a history of events is shown in a "portal" region on the screen.
Is it better to use a table or a datagrid and how would I go about this? I am stuck!

Thanks!
Rob Glassman
ArkStar

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Re: Displaying Related Records

Post by SparkOut » Tue Jan 19, 2010 11:02 am

Hi arkstar!
I am a a big fan of the datagrid, and SQL Yoga, which makes database access a lot more streamlined too.
That said, it really depends on what you have in mind, and the user interface you are building.
Are you thinking of having a table field/grid which you can click on a row to highlight the client and have a second table field/grid update with that client's related event records? Or more like a card with a field for the current client and maybe forward/back arrows and or search, and as you step through the records (each client being displayed one at a time) then the corresponding client event history is displayed in a table field/grid?
Neither are really that difficult to achieve, but there are subtleties that may make it easier to break down into simple bits one way or another, depending on how you envisage the interface. For instance, for the latter, you could have a recordset of clients retrieved on card open, with a query which triggers to retrieve related event records each time you change the cursor position in the recordset with the arrow keys. Otherwise you would be able to trigger the related record retrieval in the script of the table field/grid holding the client record when the selection is changed. A table in this instance is probably simpler than a datagrid, for getting started, but you can certainly do all sorts of fancy things in a datagrid which may be worth getting used to in the end.
HTH
SparkOut

bangkok
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 937
Joined: Fri Aug 15, 2008 7:15 am

Re: Displaying Related Records

Post by bangkok » Tue Jan 19, 2010 12:41 pm

arkstar wrote:I have a database that has several tables. One table is a list of clients. Another table is for events. My goal is when you have a client's record on the screen, a history of events is shown in a "portal" region on the screen.
Is it better to use a table or a datagrid and how would I go about this? I am stuck!
I guess you are coming from the FileMaker world, right (the word "portal") ? :)

What is a "portal" : nothing more than a view on other data.

How to do that in RunRev ?

I would go the easiest way, AKA before talking about datagrid, I would use a plain and "silly" field.

As for the process :

-your user type the name of a customer
-you make a query on your table customer
-you fetch the related record
-you populate several fields on your card (surname, family name, address for instance)
-then you make a second query, this time on your event table (using the primary key, AKA the code of the customer), to fetch all the events linked to this customer
-you display the data in a table field on the same card.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: Displaying Related Records

Post by Janschenkel » Tue Jan 19, 2010 12:49 pm

Hi Arkstar,

At the RunRevLive'09 conference in Edinburgh, I presented on the topc of using Rev and SQLite for desktop databases. You can download the presentation and example appliction here: http://www.quartam.com/downloads/tea.zip. It uses datagrids to present related data in a "master-detail" approach, and abstracts away the SQL query generation.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

arkstar
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 70
Joined: Mon Dec 21, 2009 1:51 am

Re: Displaying Related Records

Post by arkstar » Sat Feb 20, 2010 3:59 pm

Thanks for the help!
Rob Glassman
ArkStar

Post Reply