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!
Displaying Related Records
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Displaying Related Records
Rob Glassman
ArkStar
ArkStar
Re: Displaying Related Records
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
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
Re: Displaying Related Records
I guess you are coming from the FileMaker world, right (the word "portal") ?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!

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.
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Re: Displaying Related Records
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.
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
www.quartam.com