Welcome! Log In Create A New Profile

Advanced

RAD

Posted by Joel Waldron 
Joel Waldron
RAD
October 05, 2008 06:13PM
Every time I use the RAD I get an integrity error in this scenario - (as an example)

Groups:
GroupID (Automatic ID)
Group_Name
Group_Description
1,n

Group Details:
Group_Detail_ID (Automatic ID)
GroupID
Group_Detail_Description
1,1

Linked by GroupID

Now, to add, I must first add a group record and then I can start adding detail records. I use the RAD, but I get an Integrity error - I assume b/c The Group record is looking for a detail record, but one doesn't exist yet - so why both having a "each group record has at least 1 detail record" option?

I used the "Compatible 11" RAD, "Form with Linked Table" option.

I would assume that the RAD would provide me with a form to add groups first and then either display a table to add the details or take me to a for to add the details, but it looks like it did that the other way around - it gave me a single form to add details and a form (for Groups) linked to a table (showing details).

I'm sure I'm just confused as to how this all works, but I'm actually finding it easier to code by hand than use the RAD. That just can't be right.

I'm sure this might be an awfully basic question, but it's stuff like this that just has me stumped! Thanks for any help -

J

Thanks for any help.

Jimbo
Re: RAD
October 05, 2008 09:38PM
Hi Joel,

1 - I do not recommend to use the Form+Table RAD11-template, because it is much less advanced than the Form with Browse. You can easily add a Table to that and link it to one of the Form's fields (a or better THE unique key of the master file)

In short, Form+Table pattern has no [Apply] button which makes it look a bit inconsistent for your users when using Form+Table and the Form with Browse in your application.

You'd have to add a refresh to the Table anyway, because only the Table pattern has built-in refresh, which doesn't work under all circumstances but can be made quickly to do what you want.

Even the naming of procedures in the Form+Table pattern is inconsistent to the Form pattern! The RADDisplay() in Form is largely the same as the Refresh() in Form+Table.

2 - So, the recipe is as follows.

a - RAD-make a Form with Browse on the main file.
b - RAD-make a Form+Table on master and detail file. Don't care whether it's working or not.
c - make the Table small and move it towards the buttons. Mark the Table & Buttons and do a Ctrl-C for copying all of them to the clipboard.
d - show the Form and expand it at the bottom to have space for the Table & buttons.
e - Ctrl-V and position Table & buttons to your taste.

The Table's name will be LINKEDTABLE

In order to connect / display the Table add in RADDisplay() after the FileToScreen() command

// Define the search item used in the table
LINKEDTABLE..BrowsedItem = "iGroupID"

// Set a filter on the linked table
LINKEDTABLE..Filter=MainFile.iGroupID

TableDisplay(LINKEDTABLE,taInit)
TableSort(LINKEDTABLE,"DetailGroupWhatever")

This will make the Table work in sync with the Form.

There's still a lot to do, f.i. refreshing the Table after using a Form for a detail's file record.

If the Table's contents is simple enough, you could program the Table for direct input and validation.

Kind regards,
Guenter

P.S. I strongly oppose against use of Automatic IDs because you will not be able to define the sorting sequence of the main file. But that may be a matter of taste ..

Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: