Home » Developer & Programmer » Forms » RELATIONS AND TABULAR FORM (Windows XP)
RELATIONS AND TABULAR FORM [message #339977] Sun, 10 August 2008 11:19 Go to next message
Kurtn1986
Messages: 5
Registered: August 2008
Location: Belgium, Europe
Junior Member
Hello, i'm new to Oracle Forms from Developer Suite 10G.

I've got a small problem with my relations between 4 blocks.
A company has a project and multiple students are assigned to a project through a contract.

These are my 4 blocks:
1. COMPANY -->(FORM)
CCODE (NUMBER)
CNAME (VARCHAR2)

2. PROJECT -->(FORM)
PROJCODE (NUMBER)
CCODE (NUMBER)
PROJTITLE (VARCHAR2)

3. CONTRACT -->(FORM)
PROJCODE (VARCHAR2)
SCODE (NUMBER)
DCODE (VARCHAR2)
CTEMAIL (VARCHAR2)

4. STUDENT -->(TABULAR)
SCODE (VARCHAR2)
SNAAM (VARCHAR2)

The relation between company and project is based on CCODE (master-detail relation). Same between project and contract (based on PROJCODE).

But this is the problem: Contract contains several SCODE (Studentnumbers) which are different from each other. With the use of a master-detail relation, only the first student is displayed in the tabular form. How can I solve this?

Example: We got a contract with PROJCODE = 17 and the tabel CONTRACT
contains 2 rows: PROJCODE = 17 has SCODE = 042527 || PROJCODE = 17 has SCODE = 032456. The master-detail relation between contract and student returns only the first found student, while it should be 2.

Thx for helping me out.
Kurt
Re: RELATIONS AND TABULAR FORM [message #339986 is a reply to message #339977] Sun, 10 August 2008 14:54 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
One way would be to remove the fourth block (STUDENT) and modify the third block (CONTRACT) from "form" to "tabular" because the only information the fourth block offers is a student name (if that's what SNAAM column is). If so, just add a display item and populate it in the POST-QUERY trigger.

If you insist on the fourth block, standard master-detail relationship can not do that because of the column which makes the relation - SCODE. Every record in the CONTRACT block contains only one SCODE, and you can't expect having more than single "detail" record for a single student.

However, you might remove the relationship and use DEFAULT_WHERE for the STUDENT block. It would, actually, be a subquery, such as
'WHERE scode IN (SELECT scode FROM contract
                 WHERE projcode = ' || :contract.projcode ||')'
                

I didn't test it, but you might try. Although, in my opinion and regarding the information you provided, the first option is more acceptable (to me).
Re: RELATIONS AND TABULAR FORM [message #339990 is a reply to message #339977] Sun, 10 August 2008 15:55 Go to previous messageGo to next message
Kurtn1986
Messages: 5
Registered: August 2008
Location: Belgium, Europe
Junior Member
Well actually the Student blok is more then just the name:

4. STUDENT -->(TABULAR)
SCODE (VARCHAR2)
SNAME (VARCHAR2)
SFIRSTNAME (VARCHAR2)
STREET (VARCHAR2)
SCITY (VARCHAR2)

So I have to use the DEFAULT_WHERE, but how do add a DEFAULT_WHERE?
Sry I'm really a noob in this Sad
Re: RELATIONS AND TABULAR FORM [message #340034 is a reply to message #339990] Mon, 11 August 2008 02:18 Go to previous messageGo to next message
Littlefoot
Messages: 21823
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Kurt
So I have to use the DEFAULT_WHERE
No, you don't have to; all these columns may fit into my "POST-QUERY populated display items" story.

DEFAULT_WHERE is a block property; research use of the SET_BLOCK_PROPERTY built-in.
Re: RELATIONS AND TABULAR FORM [message #340085 is a reply to message #339977] Mon, 11 August 2008 06:59 Go to previous message
Kurtn1986
Messages: 5
Registered: August 2008
Location: Belgium, Europe
Junior Member
Ok,

I solved the problem by deleting the 4th block and adding items to the contract-block. Then I used the post-query like you said and it is a succes!

Thx for helping me out.
Previous Topic: Logon at RunTime
Next Topic: CHANGE MDI BACKGROUND COLOR
Goto Forum:
  


Current Time: Thu Feb 13 09:51:38 CST 2025