I am new to Oracle forms. Presently using Oracle forms 6i.
I am facing a problem when controlling the status of items within a row while choosing the 'List item'. I basically have multi-data block. On the data block I have assigned the property as 'List Item' to one of the item. This list item has three options 'MANUAL', 'AUTO' and 'ADVANCE'. When I choose the list item 'MANUAL', corresponding row should be editable and the user can insert the record in that row. But when I choose 'AUTO' or 'ADVANCE' only the specified item say for e.g. the item 'Sr.no' only should be editable while all the other items are uneditable. I have tried using set_record_property for 'MANUAL' and that serves my purpose. But have written set_item_property for 'AUTO' and 'ADVANCE' which then spoils the 'MANUAL' functionality for the next row/record after an 'AUTO' or 'ADVANCE' row is inserted.
Please help asap as this is an urgent requirement.
You should use two triggers :
1. when-new-record-instance -> in this trigger you should check the value of "List item". If the "List item" is empty you have to set all the item editable. If the "List item" is not empty you have to set items properly as per your needs regarding "List item" value.
2. when-list-changed -> Change the editable property of items appropriately depending on value selected in "List item"
The point here is you have to set/unset items in every row the user navigates to. That is done by when-new-record-instance trigger.
I agree with Gregor using the WHEN-LIST-CHANGED-trigger. But i would not set the properties INSERT_ALLOWED and UPDATE_ALLOWED in a WHEN-NEW-RECORD-iNSTANCE-trigger, but set them in the WHEN-LIST-CHANGED-trigger and in the process of filling the block(i don't know how the block is populated, if its done using EXECUTE_QUERY the trigger would be the POST-QUERY-trigger).
The statement to make an item in the current record insertable is
The built-in SET_ITEM_INSTANCE_PROPERTY you suggested is only applicable when data are retrieved from database but not when the user inserts a new record. My point/assumption is the requirement is also this : "if user creates a new record and set the list item to some value there should also be mentioned (items enabled/disabled) business logic involved."
Yes that exactly is my requirement. When I choose a value from the list item the items should be enabled or disabled.
When I choose 'MANUAL' that whole row (i.e. the items in the row should be editable) as I am inserting a new record in that particular row.
But when I choose 'AUTO' or 'ADVANCE' only two items in that row should get edited while all the other items should remain uneditable.
The data gets populated with an execute_query.
Now when I tried setting set_item_instance property on the list item here is the scenario:
When I choose 'MANUAL' initially for first time the whole row is editable but when i choose the rest of the two, what happens is, the set_item_instance property is fired and all the remaining columns are set as per editable/uneditable. Now again when I choose 'MANUAL' the item properties are not fired according to this list item(as in the whole row does not become editable).
Also it should not happen that first when I choose MANUAL, then AUTO or ADVANCE and again MANUAL the row with the list item AUTO or ADVANCE which is in between, becomes editable totally.