Home » Developer & Programmer » Forms » copy the val of previes item into next item
copy the val of previes item into next item [message #585558] Mon, 27 May 2013 12:01 Go to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
i have block display no of item 10.one of the field is time.now i want when i create new record the previos time should be auto copy into new item....
Re: copy the val of previes item into next item [message #585559 is a reply to message #585558] Mon, 27 May 2013 12:17 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
in first record it is 12:30
in the next new record this 12:30 should auto copy.
Re: copy the val of previes item into next item [message #585563 is a reply to message #585559] Mon, 27 May 2013 12:53 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
Store the last value in a global variable, or an item in a seperate datablock.
Re: copy the val of previes item into next item [message #585622 is a reply to message #585563] Tue, 28 May 2013 07:44 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
thx for reply ...but on thing is confusing me..
for example there are these data in block..

sr time task
1 7:10 0001
2 5:10 0002
3 8:10 00004

now when i create the fourth record....the 8:10 should auto copy into this...how i copy this val into global...
Re: copy the val of previes item into next item [message #585632 is a reply to message #585622] Tue, 28 May 2013 08:52 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
Look at DUPLICATE_ITEM. Maybe in WHEN-NEW-RECORD-INSTANCE?
Re: copy the val of previes item into next item [message #585693 is a reply to message #585563] Wed, 29 May 2013 03:18 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
this code is at block level when-new-record-instance...

declare
a number;
cur_rec number;
cur_form FORMMODULE;
begin
CUR_FORM:=FIND_FORM(:SYSTEM.CURRENT_FORM);
SET_FORM_PROPERTY(CUR_FORM,VALIDATION_UNIT,FORM_SCOPE);
--
:srno := 1;
cur_rec :=:system.trigger_record;
go_record(1);

a :=1;
loop

:srno :=a;

if :system.last_record = 'TRUE' Then
Exit;
else
a := a + 1;

:global.TXT_TASK_DESC := :TXT_TASK_DESC;

message('name time :'|| :global.TXT_TASK_DESC);
next_record;


end if;
end loop;

SET_FORM_PROPERTY(CUR_FORM,VALIDATION_UNIT,DEFAULT_SCOPE);

:TXT_TASK_DESC :=:global.TXT_TASK_DESC;

===========================================
this is used to create serial no in block...and also assign values in the global variable and at last assign the global value to text item but there is problem when-new-record-instance triggered for each record ...once block is executed global val assigned to text_item and once when new record is created..
i need when new record created...which trigger is suitable for this???
Re: copy the val of previes item into next item [message #585698 is a reply to message #585693] Wed, 29 May 2013 03:37 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That looks like a rather complex way to that.

What's wrong with DUPLICATE_ITEM Joy Division suggested?

Also, what do you call a "serial no"? Looks like a sequence (1, 2, 3, ...). If that's so, why would you do it that way, when :SYSTEM.CURSOR_RECORD (or :SYSTEM.TRIGGER_RECORD) does the same, but much simpler?
Re: copy the val of previes item into next item [message #585704 is a reply to message #585698] Wed, 29 May 2013 03:58 Go to previous messageGo to next message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
but i can't understand DUPLICATE_ITEM ,,what is this please explain and how i can use it????
Re: copy the val of previes item into next item [message #585706 is a reply to message #585704] Wed, 29 May 2013 04:07 Go to previous messageGo to next message
Littlefoot
Messages: 21813
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
It is explained in documentation, as well as in Forms Online Help System (press F1 while in Forms Builder and search for DUPLICATE_ITEM). However, this built-ins usage is more than obvious from its name. What do you think, what might duplicate item do?
Re: copy the val of previes item into next item [message #585720 is a reply to message #585706] Wed, 29 May 2013 05:52 Go to previous messageGo to next message
cookiemonster
Messages: 13925
Registered: September 2008
Location: Rainy Manchester
Senior Member
@irfankundi786@yahoo.com - never write a when-new-record-instance trigger that contains commands to change record.
Doing so will cause when-new-record-instance to fire again, and again, and again, and again.
Re: copy the val of previes item into next item [message #585762 is a reply to message #585706] Wed, 29 May 2013 10:17 Go to previous message
irfankundi786@yahoo.com
Messages: 269
Registered: February 2009
Location: pakistan
Senior Member
Duplicate_item....i copy this in when-new-record-instance...but it duplicate the srno but i need the task_desc third field in the block...my first item is serial no....at which trigger it should be suitable??
Previous Topic: Direct Print
Next Topic: Error 201 identifier must be declare
Goto Forum:
  


Current Time: Mon Jul 01 17:59:05 CDT 2024