Recent

Author Topic: Select-Box (Please see the picture in the details)  (Read 3201 times)

anis2505

  • Full Member
  • ***
  • Posts: 201
Select-Box (Please see the picture in the details)
« on: December 20, 2014, 02:04:07 pm »
Hi all,

long time   ;)

So I need to make a select-box ( PLZ take a look to The attached Picture )

It uses 2 TDBListBox.

it's a many to many relationship

Student 1..* <----------------------> 0..* Course

So the list will contain the courses that a student has taken

Any Idea how to make such thing.


regards
G.Anis
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

anis2505

  • Full Member
  • ***
  • Posts: 201
Re: Select-Box (Please see the picture in the details)
« Reply #1 on: December 20, 2014, 05:15:59 pm »
Please, Tell me how you manage many to many relationship,
Tell me how you do such thing not necessary using Select-Boxes.

Thank you all
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Select-Box (Please see the picture in the details)
« Reply #2 on: December 20, 2014, 06:04:12 pm »
Three tables: tblStudents, tblCourses, and tblStudentCourse.
Example:
tblStudents
ID  Name  Etc...
1   S1
2   S2
...
n  Sn

tblCourses
ID  Name  Etc...
1   C1
2   C2
...
m  Cm

When Student Sx takes a course Cy, add an entry in tblStudentCourse:
ID  SID  CID  Etc....
z    Sx    Cy

As I see it, it is one to many relation

anis2505

  • Full Member
  • ***
  • Posts: 201
Re: Select-Box (Please see the picture in the details)
« Reply #3 on: December 20, 2014, 06:26:09 pm »
Hi, Thanks for reply :)

My problem isn't database design. it's about gui design I want to add the appropriate course for a student when entering the student main information

I mean

<form>
<Main Student Information />
</Student Courses />
</form>
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

goodname

  • Sr. Member
  • ****
  • Posts: 297
Re: Select-Box (Please see the picture in the details)
« Reply #4 on: December 20, 2014, 06:48:22 pm »
If your dealing with one student or one course at a time then design two one to many screens.

Had a case once where I was adding many people to many groups in one step. The GUI had two multi-select list boxes with the items to be linked in each box selected.

engkin

  • Hero Member
  • *****
  • Posts: 3112
Re: Select-Box (Please see the picture in the details)
« Reply #5 on: December 20, 2014, 06:57:43 pm »
If the concept you have in your image is good enough, then replace TDBListBox with TListBox and build the logic in code.

anis2505

  • Full Member
  • ***
  • Posts: 201
Re: Select-Box (Please see the picture in the details)
« Reply #6 on: December 20, 2014, 07:18:31 pm »
I guess I will do as you sad.
Thank you ;)
Dear Confucius you said {A picture is worth a thousand words}
I say {a good example is worth a thousand words}

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Select-Box (Please see the picture in the details)
« Reply #7 on: December 20, 2014, 07:50:19 pm »
Your relation is  many to many, but the dialog is not that is one to many.

I think it might even behave good enough to use master-detail relations prepared in data sets. Search for "lazarus master detail" or so.

 

TinyPortal © 2005-2018