Home » Developer & Programmer » Forms » Displaying Rows into Detail Table
Displaying Rows into Detail Table [message #272775] Sun, 07 October 2007 05:24 Go to next message
mansurk
Messages: 2
Registered: October 2007
Location: KSA
Junior Member

I have a Master Detail form where i need to display the detail from another table. So i declared a cursor that reads the corresponding data and displays it in the detail rows.

The Problem is that it only shows the last row and not any row before it.
heres the code...

+++++++++++++++++++++++++++++++++++++++++++++++++++++++
DECLARE
CURSOR FILL_DETAIL IS
SELECT
LINENUM,
ITEMCODE,
BINNO,
SELUOM,
LOCATION

FROM APPS_TRANSDETAIL

WHERE TRANSNO =:APPS_TRANSHEAD.REFERENCE1
order by linenum;

BEGIN
OPEN FILL_DETAIL;
for i in 1..200
LOOP
FETCH FILL_DETAIL INTO

:APPS_TRANSDETAIL.LINENUM,
:APPS_TRANSDETAIL.ITEMCODE,
:APPS_TRANSDETAIL.BINNO,
:APPS_TRANSDETAIL.SELUOM,
:APPS_TRANSDETAIL.LOCATION;
SELECT DDRNO INTO :APPS_TRANSDETAIL.TRANSNO FROM APPS_SERCTRL WHERE LOCATION='1';
EXIT WHEN FILL_DETAIL%NOTFOUND;

END LOOP;

CLOSE FILL_DETAIL;

END;

+++++++++++++++++++++++++++++++++++++++++++
I have this on a when-validate trigger

Pls Comment!


Re: Displaying Rows into Detail Table [message #272792 is a reply to message #272775] Sun, 07 October 2007 07:33 Go to previous messageGo to next message
Littlefoot
Messages: 20896
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
OK, but - why do you do it that way? Master-detail relationship is one of the basic built-in Forms functionalities and works correctly unless you do something that prevents it to.

In other words: why did you choose to populate the detail block that way? What's wrong with the default master-detail relationship?

If you insist on this solution, perhaps the POST-QUERY trigger would suit better your needs than the WHEN-VALIDATE-RECORD (is it a _RECORD?) one (I guess declared on the master block).

In order to make other Forum members easily see what you've done, please, read the OraFAQ Forum Guide to learn how to properly format your code.

As of your question, I guess you forgot to CREATE a RECORD and, once you do that, move to the NEXT RECORD and fetch data into it. Just being curious: why did you restrict FOR loop to 200 iterations? What if cursor returns more than 200 records? You don't want to fetch them because of the business requirements, or ...?

Also, you might consider using the CURSOR FOR LOOP which is easier to maintain. If you, however, don't want to do that, I'd rather user a simple LOOP (not FOR loop!) which wouldn't be restricted to hardcoded value (200 in your case).
Re: Displaying Rows into Detail Table [message #272910 is a reply to message #272792] Mon, 08 October 2007 02:46 Go to previous messageGo to next message
mansurk
Messages: 2
Registered: October 2007
Location: KSA
Junior Member
Many Thanks for your informative reply.

First of all, I have some Invoiced items for which i want to make a Delivery Notes. According to our Business requirement we need to generate a separate sequence of documents as Invoices & the corresponding Deliveries. So instead of making the user enter the Items in the detail again, My intent is to call them into the deliveries form Detail so that they can be used subsequently.

Im validating an item which is i.e the Invoice No and then calling all the invoiced items.

Secondly, the items that we deal are small in packaging and cannot dispatch more than 200 items per shipment. But you are absolutely right, I should not hard code this.

Ill try your suggestion right now....

THANKS!

Re: Displaying Rows into Detail Table [message #272912 is a reply to message #272910] Mon, 08 October 2007 02:52 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Do not populate them manually via a block. Use an insert statement to place the records in the new table, commit your work using 'standard.commit', then go to the detail block and let the standard master-detail relationship populate the block in your form for you.

David
Previous Topic: rollback in stored procedure
Next Topic: Display Message !
Goto Forum:
  


Current Time: Tue Dec 06 04:14:59 CST 2016

Total time taken to generate the page: 0.10298 seconds