the one from when-new-form-instance ... NOTE:when I keep the code in when-new-form-instance and adding to the end of the code this instruction:
:emp.id :=Get_List_Element_Label( list_id, 1 ); The insertion will be made without error
Well, when you set the initial value of your item to '1', but do not have a value '1', what would you expect to happen. Either leave the item un-initialized and let the user choose, or, initialize with a valid value.
Edited by: Andreas Weiden on 14.01.2013 21:22
If the only allowed values for the list are the values from your parent-table, how could other values work then? The database will throw an exception. As said before, either leave the value empty by default, or initialize the value with a valid one. You could select a valid value form the table using a cursor in the WHEN-CREATE-RECORD, but in general, you only provide initial values if they make sense for the user. So either you have a rule how to set the initial value, otherwise let the user choose.
I don't understand that. How can the list have invalid values when you fill the list with valid values? And what would be the sense behind providing the user invalid values and then tell him afterwards?
To be honest, i do not understand what exactly is your problem. You created lists based on another table. So the lists are not empty. If you want to force the user to enter something, set the required-property to Yes.
If i didn't get you right, please give a more detailed explanation of your problem.