I am having a form in which I had two sections, master and detail. Master section has a field in which I select week range like 01-FEB-2012-07-FEB-2012.
Based upon this I am populating with the help of CREATE_RECORD(writted in when new block of detail) , 7 rows in the detailed section,
There are other columns in the detail section beside this date field. Now at a stage when nothing is saved, I can go in the master block and change the week rangeb from LOV and accordingly the date field in the detail section gets populated with new 7 days/rows. (Its happening as the system.record_status = INSERT).
Now what I need is when I select the date range in master, 7 days as usual gets populated in detail section. Now I save and then I try to change the lov for the date range in master i doesn't allow me to change .(presently the system.record_status = QUERY) although I have taken 3 modes (NEW , INSERT & QUERY in the when new block code.
I am now not able to sure if at all what I want is feasible or not considering the mode when its QUERY. I tried doing some r&d but not of much help. Can anyone plz advise if this is a feasible requirement or not possible as per standard method.
Appreciate suggestions on this.
Thanks & Regards,
Thanks for your suggestion. There is no custom save button explicitly in the form. I use CRTL-S or the seeded save button to save.
Are u suggesting the form clear to applied in the ON_COMMIT trigger at form level.
Even it works, I believe once I save form will be cleared immediately which also would not be desirable as after save immediately data should not get disappeared.
But I can definitely give it a try.
Write a Key-Commit - Trigger. Ctrl S will execute the Key-Commit-Code. The Key-Commit-Trigger must contain a commit_form. If you create a push-button for commit-processing, just write Do_Key('commit_form') in your when-button-pressed trigger. This will start Key-Commit.
In general I don't understand what you are trying to do in your detail-block. The master seems to be a control-block without a table, but what are you doing in the detail-block?
- Initialize an intervall with new records?
- Query all records in the intervall given by the master?
- are you using the database at all?
I have a form in which I have master and detail form.
I have one Item in the master block: 'Week". An LOV is attached where I am bringing a list of week ranges: lie "01-JAN-2013 - 07-JAN-2013" , "08-JAN-2013 - 14-JAN-2013" and so on.
Now I select, say the week as "01-JAN-2013 - 07-JAN-2013".
In the 7 rows detail block, create_record logic is written in when new block(detail) , which populates 2 fields Day &Date field in detail block based upon week range entered in Master e.g.
Once 7 dates populated, then if I again go back to master and change the week range, the day/dates in the detail will also get changed. NOW THIS IS HAPPENING IF NOTHING WAS SAVED.
IF I SAVE FIRST TIME, Then if I try to change the LOV for the week range lov, its simple not allowing me to do so. When I try to click on the LOV, I cannot change anything.
So conclusion is if nothing is saved, I can change the week LOV as many times as possible and if saved, I am not able to do any change in the week range LOV.
When transactions are not saved and are only entered, record_status = INSERT and when saved, record_status = QUERY. I have incorporated both in my when new block code still its not working for saved ones.
I don't know what you actually you can replace LOV with list item as below and also follow the logic below. It will work for you.
List Item name "WEEK"
List Element List Item Value
01-JAN-2013 - 07-JAN-2013 '01-JAN-13' AND '07-JAN-13'
08-JAN-2013 - 14-JAN-2013 '08-JAN-2013' AND '14-JAN-2013'
and so on
And put code below in when list changed event of the list item
GO_BLOCK('Your Block Name'); -- Detail block name
SET_BLOCK_PROPERTY('Your Block Name',DEFAULT_WHERE,'MDate BETWEEN '||:WEEK);
--MDate is the column name which you want to filter
This method is easy and fast.
Edited by: Ahamed Rafeeque on Feb 10, 2013 5:39 AM
Actually where clause is not applicable in my requirement. I am not finding anything in the detail block. I will be creating new records based upon the week LOV value entered.
The form is used to create employee's weekly shift. So if I want to create shift for an employee say XYZ for the week 01-JAN-2013 - 07-JAN-2013. I will select the value as 01-JAN-2013 - 07-JAN-2013 from the LOV in master block.
Then I move to the detail block, and as a result of the code written in when new block of detail,
the column DAY & DATE will be autopopulated for the 7 rows:
and so on ........till
Now there are other columns beside DAY & DATE like shift name.
I provide a shift name on each of the 7 days and I save it.
Now my screen in master wil look like:
Employee : XYZ Week: 01-JAN-2013 - 07-JAN-2013
Detail screen will look like:
DAY DATE SHIFT and there are other columns
SUN 01-JAN-2013 Morning
MON 02-JAN-2013 Morning
TUE 03-JAN-2013 ..........
and so on ........till ...........
SAT 07-JAN-2013 Night
At this stage if I go to the master screen and try to change the LOV value to say 08-JAN-2013 - 15-JAN-2013. Then I expect that detail screen will be autopopulated with new values :
and so on ........till
This thing is happening at the unsaved stage i.e if not saved and I change the LOV value in master multiple times, the detail will be autopopulated everytime replacing the previous 7 rows.
But not working once SAVED i.e its not allowing to change value in the week LOV in master. I am able to click but it doesn't opens up the list.
Hope I am able to explain the issue.
I observed something in the master block. I am unable to change whatever LOV's are there in Master block. Detail block I am able to change. Master is based on view and details is based on table.
Issue : Immediately after save, when I try to change LOV value in master, it doesn't allow me to change as discussed
When I close the form and query the same data, then I am able to change LOV values in master. This is surprising i.e immdiately after save it is not allowing but after querying and then chaning LOV , its allowing.
Please try to following command immediately after saving (commit_form) the data.
May be this will help you.
Ahamed Rafeeque Cherkala.
If you are not able to change a record after saving there might be the error "Record has been changed by another user" which will be shown in the console-window. DO you have the console-window set? Do you see any error there?