I'm trying to modify table record from Card Form. Each time retrieving table record, I want to modify that record in Form - OnAfterGetRecord trigger. I tried to assign value to a field and added CurrForm.SAVERECORD() function in this trigger but system is asking to rename the record. This is not what I wanted. I want each time while retrieving table record, I want to assign value to a field and save it in table. And while to view table list, I want to see record with new modified field. Any idea? Please share..
Do you really need those calculated values as fields on the table? Otherwise, just use global variables (if they need to be modifyable) or place the calculating expression in the SourceExpr property of the control showing the value.
Are all these values fields in your table? If Yes, you probably should drop one of each tripple. If you need to keep them all, add OnValidate trigger code to the table fields to keep them consistent at all times.
If you still need to modify the record in the OnAfterGetRecord trigger of the form, try MODIFY(TRUE) rather than CurrForm.SAVERECORD. The record has just been retrieved from the database and the form's controls are not yet updated.
You should not do this on the form but instead set the field values in the OnValidate() trigger of the various fields - and then make sure you VALIDATE the fields if setting them in code.
OnAfterGetRecord is used to get information not to write information.
You can use that trigger to calculate variables that depend on the current record.
I don't think you can do it there and even if you could I don't think it's a good way of handling whatever you are trying to achieve.
Every time someone opens that form reading & writings will constantly be occuring.
Perhaps you should rethink on how to accomplish this task.
Yes, I think itz true. We cannot actually modify record each time Form retrieving it from table. I've tried most of the method and all return error. So itz true.
Comments
What is your business need?
What did you try so far and why did it fail?
I'm trying to modify table record from Card Form. Each time retrieving table record, I want to modify that record in Form - OnAfterGetRecord trigger. I tried to assign value to a field and added CurrForm.SAVERECORD() function in this trigger but system is asking to rename the record. This is not what I wanted. I want each time while retrieving table record, I want to assign value to a field and save it in table. And while to view table list, I want to see record with new modified field. Any idea? Please share..
You need to explain more about whatever you are doing and why you would rather use code on a form instead of a table.
http://www.BiloBeauty.com
http://www.autismspeaks.org
This is what I developed here.
Are all these values fields in your table? If Yes, you probably should drop one of each tripple. If you need to keep them all, add OnValidate trigger code to the table fields to keep them consistent at all times.
If you still need to modify the record in the OnAfterGetRecord trigger of the form, try MODIFY(TRUE) rather than CurrForm.SAVERECORD. The record has just been retrieved from the database and the form's controls are not yet updated.
You can use that trigger to calculate variables that depend on the current record.
I don't think you can do it there and even if you could I don't think it's a good way of handling whatever you are trying to achieve.
Every time someone opens that form reading & writings will constantly be occuring.
Perhaps you should rethink on how to accomplish this task.
http://www.BiloBeauty.com
http://www.autismspeaks.org