Home » Developer & Programmer » Forms » set_item_property.. (forms 10g)
set_item_property.. [message #640306] Mon, 27 July 2015 03:00 Go to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo All..

I have master-detail with two detail blocks.
and i am trying to set some item property insert/update = true/false as per my condition.
i wrote this code in When-New-Record-Instance Trigger in Master-Block.
But, my third condition does not works as i wanted to have. If both condition matched then should allowed to update and insert otherwise allow just in one of them.

if condition1 = 1 then
set_item_property('Block1.item1', insert_allowed, property_true);
set_item_property('Block1.item2', update_allowed, property_true);
............... ............	........... .........
set_item_property('Block2.item1', insert_allowed, property_false);
set_item_property('Block2.item1', update_allowed, property_false);
................ ...........	............. ...........

elsif condition2 = 1 then
set_item_property('Block2.item1', insert_allowed, property_true);
set_item_property('Block2.item2', update_allowed, property_true);
...........................	....................
set_item_property('Block1.item1', insert_allowed, property_false);
set_item_property('Block1.item1', update_allowed, property_false);
.............. .............	........... .............

else 
set_item_property('Block1.item1', insert_allowed, property_true);
set_item_property('Block1.item2', update_allowed, property_true);
............... ............	.......... ..........
set_item_property('Block2.item1', insert_allowed, property_true);
set_item_property('Block2.item1', update_allowed, property_true);
............. ..............	............ ............
end if;


How can i do this? Can anyone please help me?

thankx in advance

Regards,
Re: set_item_property.. [message #640308 is a reply to message #640306] Mon, 27 July 2015 03:15 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
If you want both conditions matching to trump everything else then you need to check that first.
IF/ELSIF constructs find the first IF that evaluates to TRUE and run that.
Re: set_item_property.. [message #640309 is a reply to message #640308] Mon, 27 July 2015 03:27 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo ..
thankx for your reply Smile

yes, it works for first and second condition, but when both conditions matched (the third condition) then block1's fields are allowed to insert/update but not the block2's field.

any Suggestion?

regards.
Re: set_item_property.. [message #640310 is a reply to message #640309] Mon, 27 July 2015 03:35 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
You've failed to understand my point. If both conditions match it will run the code in the first IF. You'll only get the ELSE if neither match.
Re: set_item_property.. [message #640311 is a reply to message #640310] Mon, 27 July 2015 03:40 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
ok.. Smile thank you Smile

is there any other way to get my third condition works?...

Re: set_item_property.. [message #640312 is a reply to message #640311] Mon, 27 July 2015 03:45 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
Other than the correct way that I've already pointed out, which would take you 10 seconds to implement?
No.
Re: set_item_property.. [message #640314 is a reply to message #640312] Mon, 27 July 2015 03:54 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hi.. thankx a lot for your Suggestion and Feedback Smile
and sorry that i did not understand it before.. then i read it again and i got it the Points and it works now Smile

thankx
Re: set_item_property.. [message #640318 is a reply to message #640314] Mon, 27 July 2015 04:29 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo again.

How can i retrive some of the records of previous row into current row, when the Cursor is in the next empty row in the same block?
Any Suggestion please ? Smile
Re: set_item_property.. [message #640329 is a reply to message #640318] Mon, 27 July 2015 06:20 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
You'll need to explain that in more detail. How can the previous row have multiple records?
Re: set_item_property.. [message #640331 is a reply to message #640329] Mon, 27 July 2015 06:40 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo Cookiemonster..

Well, I have master-Detail block and i want to insert new records in my Detail-block. Actually, some of them fields are same as previous records but just Need to Change one field in new records. for e.g.:

item1 item2 item3 item4
text1 abc def ghi@klm.com
"" "" "" mno@pqr.com
..... ..... .... ..........
..... ..... .... ..........

in my case: when i goto next row then it should Display all the records till item3 (like: in item1: text1, in item2: abc, and in item3: def and in item4: will be inserted new email address) in the current row, and will Change or insert new email address in item4.
Any Suggestion or help please? thanking you in advance.
Regards,

PS: sorry for formating.

[Updated on: Mon, 27 July 2015 06:43]

Report message to a moderator

Re: set_item_property.. [message #640351 is a reply to message #640331] Mon, 27 July 2015 08:25 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
Create a control block with items for item1 - item3.
Add a When-Validate-Item trigger to each item in the detail block so that whenever one is changed it's current value is copied to the equivalent item in the control block.
In the When-New-Record-Instance trigger on the detail block check the record_status - if it's new copy the current values from the control block items to the corresponding items in the control block.
Re: set_item_property.. [message #640352 is a reply to message #640351] Mon, 27 July 2015 08:26 Go to previous messageGo to next message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
PS- it's easier to format data in code tags.
Re: set_item_property.. [message #640383 is a reply to message #640352] Mon, 27 July 2015 13:54 Go to previous messageGo to next message
Littlefoot
Messages: 21358
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I'd rather DUPLICATE_RECORD and set some items to NULL afterwards.
Re: set_item_property.. [message #640393 is a reply to message #640383] Tue, 28 July 2015 00:53 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hi..

Thank you very much for your Suggestion and help.
I have written When-New-Record-Instance Trigger in Detail-block:

if :System.record_status = 'new' then
  duplicate_record;
end if;


and it works, as i wanted to have, i mean, when i click to the next empty row, then it will Display the same records as above it.

Thank you all Smile

Regards,
Re: set_item_property.. [message #640415 is a reply to message #640393] Tue, 28 July 2015 05:41 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
Hallo again,

I post before it works now, but i am having bit Problem on it..

Actually, it inserts the same record as previous in the current-row where Cursor is active or when i click to the new row, but it also insert the rows below, when i click in the other rows below too. But, i would like to have one row insert at a time and Need to Change some fields in the current row and if needed then after into other rows too.

How can i do this? Can you please give me some idea?

regards,
Re: set_item_property.. [message #640424 is a reply to message #640415] Tue, 28 July 2015 06:58 Go to previous messageGo to next message
palpali
Messages: 138
Registered: December 2014
Location: India
Senior Member
well.. i think i found the current solution,

if :System.record_status = 'new' then
  duplicate_record;
  :detail-block.item4 = null;
end if;


is it right?

regards,
Re: set_item_property.. [message #640436 is a reply to message #640424] Tue, 28 July 2015 08:58 Go to previous message
cookiemonster
Messages: 13011
Registered: September 2008
Location: Rainy Manchester
Senior Member
ignoring the obvious typos, probably
Previous Topic: post-query Trigger error
Next Topic: Parse Message
Goto Forum:
  


Current Time: Sun Feb 18 18:16:20 CST 2018

Total time taken to generate the page: 0.02763 seconds