|
|
|
|
|
Re: serial numbers [message #414707 is a reply to message #414675] |
Thu, 23 July 2009 04:32 |
blaxmi
Messages: 36 Registered: May 2008 Location: Hyderabad
|
Member |
|
|
Ok if that is the case you can use this code for auto generated sequence. Before that, create a control item with the name sno and change some of the properties in calculation mode to that control item. change calculation mode to summary, summary function would be max, summarized block to your actual block name and finally the summarized item to actual serial number column in your form. Keep in mind the sno item should not be a database item.
Then, create two triggers one is at block level(when_new_record_instance) and other is at item level as key_next_item.
when_new_record_instance:
if :system.record_status in ('NEW') and :sno is null then
begin
:ec_dtl.ec_int_code:=nvl(:sno,0)+1;
end;
else if :system.record_status in ('NEW') and :sno is not null then
:ec_dtl.ec_int_code:=nvl(:sno,0)+1;
end if;
end if;
In the second trigger, use this code:
if :system.record_status in ('new','query') then
begin
:ec_dtl.ec_int_code:=nvl(:sno,0)+1;
end;
end if;
Use this code as i said and let me know.
|
|
|
|
Re: serial numbers [message #415122 is a reply to message #414707] |
Sat, 25 July 2009 01:18 |
|
hi i tried your option but i am gettig this message
FRM-30392: Warning: Initial Value ignored for calculated item OW_AIC_PHY_STK_ITEM.SNO.
FRM-30425: Summarized database item must reside in a block with Query All Records or Precompute Summaries set to Yes.
Item: SNO
Block: OW_AIC_PHY_STK_ITEM
|
|
|
|
Re: serial numbers [message #415129 is a reply to message #415126] |
Sat, 25 July 2009 02:09 |
|
hi that error is resolved but i am getting the same number in all the fields what i did i created two items one is display item sno with visible option set to no and the other option serno with display option set to yes
i wrote the following triggers one on when new record instance
IF :SYSTEM.RECORD_STATUS IN ('NEW') AND :SNO IS NULL THEN
BEGIN
:OW_AIC_PHY_STK_ITEM.SerNO := NVL(:SNO,0)+1;
END;
ELSE IF :SYSTEM.RECORD_STATUS IN ('NEW') AND :SNO IS NOT NULL THEN
:OW_AIC_PHY_STK_ITEM.SerNO := NVL(:SNO,0)+1;
END IF;
END IF;
and the other one on key next item on a field whose values changes
IF :SYSTEM.RECORD_STATUS IN ('NEW','QUERY') then
begin
:ow_aic_phy_stk_item.sno := nvl(:sno,1)+1;
end;
end if;
acutally the logic is i am doing post insert to populate the detail form
|
|
|
|
|
Re: serial numbers [message #415259 is a reply to message #414675] |
Sun, 26 July 2009 23:05 |
blaxmi
Messages: 36 Registered: May 2008 Location: Hyderabad
|
Member |
|
|
Hi
I had understand your problem. here i'm attaching sample .fmb for your persual. check the mistake where you have done.
|
|
|