Home » Developer & Programmer » Forms » serial numbers (Forms 6i)
serial numbers [message #414675] Thu, 23 July 2009 03:10 Go to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

how i can add serial numbers in my form as control item
Re: serial numbers [message #414692 is a reply to message #414675] Thu, 23 July 2009 03:59 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Serial number? What do you call a "serial number"? Would it be, in a multi-record block, number that represents each record? Such as
1  Arif
2  Little
3  Foot
|
v
is this a "serial number?

If so, check what :SYSTEM.TRIGGER_RECORD does and use it to populate this item.
Re: serial numbers [message #414698 is a reply to message #414692] Thu, 23 July 2009 04:05 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

Yes littlefoot you are right i meant that way only and its on multi record block.do you have any sample.
Re: serial numbers [message #414699 is a reply to message #414675] Thu, 23 July 2009 04:06 Go to previous messageGo to next message
blaxmi
Messages: 36
Registered: May 2008
Location: Hyderabad
Member
Hi

Do you want auto generated serial numbers?
Re: serial numbers [message #414700 is a reply to message #414675] Thu, 23 July 2009 04:07 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

yes you got it right i want it that way and the same to be printed on report from form
Re: serial numbers [message #414707 is a reply to message #414675] Thu, 23 July 2009 04:32 Go to previous messageGo to next message
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 #414712 is a reply to message #414707] Thu, 23 July 2009 04:50 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
This is just too complicated; I'd rather use POST-QUERY trigger (which would populate item when querying existing data) and WHEN-CREATE-RECORD (which would fire when you'd create a new record).

Both triggers would look the same:
:block_name.serial_number_item := :system.trigger_record;
Re: serial numbers [message #415122 is a reply to message #414707] Sat, 25 July 2009 01:18 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

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 #415126 is a reply to message #415122] Sat, 25 July 2009 01:54 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So do as you were told:
Quote:
Summarized database item must reside in a block with Query All Records or Precompute Summaries set to Yes
Re: serial numbers [message #415129 is a reply to message #415126] Sat, 25 July 2009 02:09 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

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 #415176 is a reply to message #415129] Sat, 25 July 2009 15:50 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Just being curious: did you even try what's been suggested in message #414712?
Re: serial numbers [message #415185 is a reply to message #415176] Sun, 26 July 2009 00:38 Go to previous messageGo to next message
arif_md2009
Messages: 732
Registered: May 2009
Location: United Arab Emirates
Senior Member

thanks littlefoot i did try but it didnt work hence i made a database column through progamming i am putting the serial number
Re: serial numbers [message #415259 is a reply to message #414675] Sun, 26 July 2009 23:05 Go to previous message
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.
Previous Topic: Error while installing Forms 11g :checking physical memory
Next Topic: Unable to delete new record because of when_new_record Trigger.
Goto Forum:
  


Current Time: Sun Dec 04 12:57:55 CST 2016

Total time taken to generate the page: 0.15288 seconds