Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: How to Increment the value of a feild sequentillay in a multi

RE: How to Increment the value of a feild sequentillay in a multi

From: Abdul Aleem <dmit_at_beaconhouse.edu.pk>
Date: Sat, 17 May 2003 02:31:43 -0800
Message-ID: <F001.0059BC3B.20030517023143@fatcity.com>


The logic is to be placed in the when-new-record-instance trigger: Validation unit must be at least Block or higher (not record or item)

1- go to previous record
2- pick up the month from it
3- move back to the new record
4- increment and replace the month.

HTH! Aleem

 -----Original Message-----

Sent:	Saturday, May 17, 2003 2:37 PM
To:	Multiple recipients of list ORACLE-L
Subject:	Re: How to Increment the value of a feild sequentillay in a
multi-record block ?

Hello:
A few days back I had posted the following question to our list,




Hello All:
I am using Forms 6i.
I have a situation whichnrequires that in a multi-record block, I want the value of month field to be incremented automatically as the user navigates down the block.Only in the first record the user enters the month after that

the month field in the subsequent records should be sequentially incremented

by 1.
Can anyone please forward me the code in PL/ SQL for doing this. Regards,
Faiz



but I could get no replies to my question. So I had to break my head on my own and find a solution for that. I could find not one but two solutions:   Ist Soultion
The eample is built on a form with EMP block. In the Trigger
when-new-block-instance (Emp Block)
:Global.currdate := '';

In the Trigger
when-new-record-instance (Emp Block)
If :Hiredate is not null and :Global.currdate is null then If :System.last_record <> 'True' then
last_record;
:Global.currdate := to_char(:hiredate,'dd-mon-yyyy');
End if;
End if;
In the Trigger (hiredate Item)
when-new-item-instance
IF :System.Record_Status IN ('CHANGED','INSERT') THEN IF :hiredate is null then
:hiredate := Add_months(to_date(:Global.currdate,'DD-Mon-YYYY'),1);
:Global.currdate := to_char(:hiredate,'dd-mon-yyyy');
end if;
end if;

IInd Solution : -
  We can do the same thing by defining a when-new-rcord-instance trigger and

a when-new-block instance trigger and using a loop to increment the value of

a global variable.

Hope this helps others who face a similar situation in future.

Regards,
Faiz



MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: FAIZ QURESHI
  INET: faizq_at_hotmail.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.net
-- 
Author: Abdul Aleem
  INET: dmit_at_beaconhouse.edu.pk

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Sat May 17 2003 - 05:31:43 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US