Home » Developer & Programmer » Forms » conditional updation of the database item
conditional updation of the database item [message #191429] Wed, 06 September 2006 06:04 Go to next message
manyal
Messages: 77
Registered: March 2005
Member
Dear Freinds,

I am using form6i as a front end tool.my problem is as follows:

I am having one master detail form and in detail block there is one field named budgetcode which should be updateble if and only if it contains some particular values which are known to me(for example ME,MS,MW etc are amongst those values,if these are the existing value of the field than only the field can be updated otherwise not.)

what should i do now?

thanx in advance!


manyal
Re: conditional updation of the database item [message #191439 is a reply to message #191429] Wed, 06 September 2006 06:38 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
you could make this in the WHEN-NEW-RECORD-INSTANCE trigger;
if the value is in your list, enable update for the item.
otherwise disable it.

sample:
BEGIN
    IF :BLOCK.ITEM in ('ME','MS','MW') THEN
       SET_ITEM_INSTANCE_PROPERTY('BLOCK.ITEM', CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_TRUE);
    ELSE
       SET_ITEM_INSTANCE_PROPERTY('BLOCK.ITEM', CURRENT_RECORD, UPDATE_ALLOWED, PROPERTY_FALSE);
    END IF;
END;

Re: conditional updation of the database item [message #191541 is a reply to message #191439] Thu, 07 September 2006 01:30 Go to previous messageGo to next message
manyal
Messages: 77
Registered: March 2005
Member
Dear friend,

i followed the steps guided by you now my problem is solved .

so thanx a lot.


now one more problem is there suppose i am having one master detail
form and there are some records in detail block now my problem is that i want to know whether the record is being modified or it is being inserted first time while entering the data in detail block.

because update property of the items is to be set accordingly.


manyal



Re: conditional updation of the database item [message #191546 is a reply to message #191541] Thu, 07 September 2006 01:47 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
i think the GET_RECORD_PROPERTY or SYSTEM.RECORD_STATUS built-ins can check this for you, e.g.

IF :SYSTEM.RECORD_STATUS = 'NEW' THEN
...
ELSIF :SYSTEM.RECORD_STATUS = 'INSERT' THEN
...
ELSIF :SYSTEM.RECORD_STATUS = 'CHANGED' THEN
...
END IF;

Re: conditional updation of the database item [message #191627 is a reply to message #191546] Thu, 07 September 2006 06:22 Go to previous messageGo to next message
manyal
Messages: 77
Registered: March 2005
Member

This is also solved now one more is ready.

is there any way to jump into one particular text item after leaving one particular item.

as i don't want to allow any user to go any other ITEM except
ITEM.MIDDLENAME after entering ITEM.FIRSTNAME by any navigation method(like TAB,ENTER,MOUSECLICK).


and one more if you are not irritating .........


is there any way to know whether one particular item has been changed or not in the current record..


Thanx
Re: conditional updation of the database item [message #191632 is a reply to message #191627] Thu, 07 September 2006 06:41 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
Quote:


as i don't want to allow any user to go any other ITEM except
ITEM.MIDDLENAME after entering ITEM.FIRSTNAME by any navigation method(like TAB,ENTER,MOUSECLICK).



yes, set the property "Next Navigation Item" for these items.

Quote:


is there any way to know whether one particular item has been changed or not in the current record.



you could check this with the GET_ITEM_PROPERTY('BLOCK.NAME', DATABASE_VALUE) built in.

this is from forms help:
Quote:


For a base table item that is part of a database record whose status is QUERY or UPDATE, Database_Value returns the value that was originally fetched from the database. When a fetched value has been updated and then subsequently committed, Database_Value returns the committed value.
For a control item that is part of a database record, Database_Value returns the value that was originally assigned to the item when the record was fetched from the database.
For any item that is part of a non-database record whose status is NEW or INSERT, Database_Value returns the current value of the item.

Note: You can examine the Database_Value property to determine what the value of an item in a database record was before it was modified by the end user.
Note: You can examine the SYSTEM.RECORD_STATUS system variable or use the GET_RECORD_PROPERTY built-in to determine if a record has been queried from the database.



Re: conditional updation of the database item [message #191847 is a reply to message #191429] Fri, 08 September 2006 06:29 Go to previous messageGo to next message
manyal
Messages: 77
Registered: March 2005
Member
Dear Jowahal,

I have set the property 'NEXT NAVIGATION ITEM' to the desired text item but it is not working what cud be the reason?


manyal
Re: conditional updation of the database item [message #191849 is a reply to message #191847] Fri, 08 September 2006 06:36 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
mouse-click will not work, but navigating with TAB is not successful?
Re: conditional updation of the database item [message #192117 is a reply to message #191849] Mon, 11 September 2006 01:22 Go to previous messageGo to next message
manyal
Messages: 77
Registered: March 2005
Member
yeh still not working!!!!!!!

any other way ?

Manyal
Re: conditional updation of the database item [message #192129 is a reply to message #192117] Mon, 11 September 2006 02:47 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
any triggers on the item (KEY-NXTFLD, ...)?
Re: conditional updation of the database item [message #192182 is a reply to message #191849] Mon, 11 September 2006 06:47 Go to previous messageGo to next message
manyal
Messages: 77
Registered: March 2005
Member


I have tried the go_item() in both the triggers (when validate item and key nxt item) but it fails and cursor is focusing in the default next field.

do something.........

Manyal
Re: conditional updation of the database item [message #192185 is a reply to message #192182] Mon, 11 September 2006 07:02 Go to previous messageGo to next message
jowahl
Messages: 82
Registered: May 2006
Member
could you post the fmb?
or send it to keineechte@hotmail.com?

i will analye it as soon as possible.
Re: conditional updation of the database item [message #192562 is a reply to message #192182] Tue, 12 September 2006 20:58 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
You can't use a 'go_item' in a When-Validate-Item trigger as 'go_item' is a restricted procedure and WVI only supports 'SELECT statements' and 'unrestricted builtins'.

One method is to disable all the fields between the 'current' field and the one to which you wish to navigate. Then 'turn them back on' when you get there, maybe.

David

[Updated on: Wed, 13 September 2006 02:28]

Report message to a moderator

Re: conditional updation of the database item [message #192583 is a reply to message #192562] Tue, 12 September 2006 22:37 Go to previous message
manyal
Messages: 77
Registered: March 2005
Member
Dear David,

Thanx a lot . you have solved my problem.


manyal
Previous Topic: Libraries
Next Topic: lov performance
Goto Forum:
  


Current Time: Fri Dec 09 23:15:04 CST 2016

Total time taken to generate the page: 0.05076 seconds