Riaz Mahmood
|
| Posted: 01/27/2002, 1:55 PM |
|
hi all cc developers,
My question is regarding development of parent child form (i.e. form with subform in MS Access) in Code Charge (preferably ASP) .
An example could be an employee table and children table. An employee can have more than one child.
EMPLOYEE ( empid, ename, eage, etelephone)
CHILDREN (childid, childname, sex, age, age )
If any one can solve this problem, kindly send me the code in cc format at
mail_riaz@yahoo.com
Cheers
/riaz
|
|
|
 |
Riaz Mahmood
|
| Posted: 01/27/2002, 2:08 PM |
|
kindly read the children table's last filed as empid i.e the F.K
CHILDREN (childid, childname, sex, age, empid )
|
|
|
 |
Teufel
|
| Posted: 01/27/2002, 4:02 PM |
|
One way to do that I imagine is just make 2 different pages:
1) The parent page (Record Form) should be entered first, where the primary key 'empid' will be generated.
2) You would have a separate page for the insertion of children (also another Record Form). The user would then navigate to this page and insert how many children he wants. The foreign key 'empid' would be used as a List Box field, so that the user can choose only among valid parents. You would probably like to show the name of the parent and not his id, so that you would have to specify at the 'List' option inside 'Field Properties' that the List Box should show 'ename' and not 'empid'.
The problem with this approach is that you would not be able to see the child records at the same page as the parent (as you can do in Access), but I believe you could make a grid showing 'parent' records and when entering the detail page (passing 'empid' as parameter), you could have two forms: one would be a Record Form showing the detailed information about the parent, and the second one would be a grid form selecting only those children for which 'empid' equals the parent.
I am also learning how to use CC, so especially many things about navigation and how to construct the actual structure of the site I am also trying out.
If anybody has some example about the problem, that would be nice to check out.
Hope this helps,
Teufel
|
|
|
 |
michael
|
| Posted: 01/28/2002, 12:08 AM |
|
Teufel, I use the same ways as you mention, however, when I click the insert in the grid form (child), if there is a record esixted, then I could not see the insert function, but update, delete and cancel function, any hints.
|
|
|
 |
Nicole
|
| Posted: 01/28/2002, 5:17 AM |
|
Michael,
most probably you have primary key field added to Grid from as Input parameter and it is marked as 'Transfer'. That's why it is added as parameter to Insert link and passed to record form. So it is in update mode.
Check it and do not mark primary key as 'Transfer'.
|
|
|
 |
jerry
|
| Posted: 11/05/2002, 10:57 PM |
|
see CodeCharge 2.0 Users Guide.pdf page 100 - Master/Detail page
|
|
|
 |
RonB
|
| Posted: 11/08/2002, 11:15 PM |
|
just an observation. The table structure you described for children has no reference to the employee table. how do you intend to link children to employees?
EMPLOYEE ( empid, ename, eage, etelephone)
CHILDREN (childid, childname, sex, age, age )
I'd recommend:
EMPLOYEE ( empid, ename, eage, etelephone)
CHILDREN (childid,child_emp_id, childname, sex, age, age )
This way you have a unique key for every child record (child_id) and an id field that identifies the employee that is the parent for this child(child_emp_id).
you could also modify the table so it becomes a relations table:
relations (rel_id, rel_emp_id, rel_name, rel_sex,rel_age, rel_type)
rel_type refers to the kind of relations(put them in a separate table(relations_type (rel_type_id, rel_typ_desc) wich you fill with values like child, partner, mother, father, etc etc.)
|
|
|
 |
|