Yes, this issue has been brought up many times before and I know there are browse issues but, nevertheless, I'm hoping to get lucky and find a solution to my problem. After much searching on this board and much trial and error, I still can't find a method that will properly refresh an embedded browse in a "parent" form when a new child record is added via a "child" form.
No, adding the new records directly into the embedded browse is not feasible. The child table has about 51 fields and the form is used with conditional objects to dynamically display only those fields that need to be filled based on previously entered data. For anyone interested, the forms can be seen at www.aimsdc.net/Posts/st_Forms.htm. The Work Order form shown is just one version of the conditional objects - the one that displays the most fields. The embedded browse is on tab 2 of the Master Order form. (For anyone reading this in the future, the page name will probably change in a month or so when this is finished and the website is updated.)
I did think of adding the new record into the embedded browse via xbasic then immediately popping up the "child" form to edit it but this eliminates the ability to cancel the new entry and I've already been through that problem with a user of the current app - it raises too many other issues.
I tried every combination of resynch(), refresh(), repaint(), refresh_browse(), refresh_layout(), etc. that I could think of but nothing would work. Even doing a Page_up/Page_down on the parent record didn't do it and I noticed that changing the form to design mode and back didn't do it either. I eventually found that a query method (from the Help file) would work but it shows a "Record is past end of file" error every time the FIRST child record is added. (It's OK on the 2nd and subsequent records.) Here's the method: (the error occurs on the query() line)
rec = fp:tables:ord_head.recno()
.....(various data checks)
fp:tables:ord_item.filter_expression = ".T."
fp:tables:ord_item.query()
fp:Tables:ord_head.Fetch_Goto(rec)
fp.resynch()
fp.activate()
fp.show()
parentform.close()
I did find one thing that works without error messages every time but I hope I don't have to go back to it:
Get the record number of the parent form, Get the ID number of the new child record, Close the parent form, Re-Open the parent form, Fetch the original parent record, activate the browse.
Anybody know a better way?? Perhaps another version of a query? (Note: it would be greatly preferred that the query not limit the parent records.)
No, adding the new records directly into the embedded browse is not feasible. The child table has about 51 fields and the form is used with conditional objects to dynamically display only those fields that need to be filled based on previously entered data. For anyone interested, the forms can be seen at www.aimsdc.net/Posts/st_Forms.htm. The Work Order form shown is just one version of the conditional objects - the one that displays the most fields. The embedded browse is on tab 2 of the Master Order form. (For anyone reading this in the future, the page name will probably change in a month or so when this is finished and the website is updated.)
I did think of adding the new record into the embedded browse via xbasic then immediately popping up the "child" form to edit it but this eliminates the ability to cancel the new entry and I've already been through that problem with a user of the current app - it raises too many other issues.
I tried every combination of resynch(), refresh(), repaint(), refresh_browse(), refresh_layout(), etc. that I could think of but nothing would work. Even doing a Page_up/Page_down on the parent record didn't do it and I noticed that changing the form to design mode and back didn't do it either. I eventually found that a query method (from the Help file) would work but it shows a "Record is past end of file" error every time the FIRST child record is added. (It's OK on the 2nd and subsequent records.) Here's the method: (the error occurs on the query() line)
rec = fp:tables:ord_head.recno()
.....(various data checks)
fp:tables:ord_item.filter_expression = ".T."
fp:tables:ord_item.query()
fp:Tables:ord_head.Fetch_Goto(rec)
fp.resynch()
fp.activate()
fp.show()
parentform.close()
I did find one thing that works without error messages every time but I hope I don't have to go back to it:
Get the record number of the parent form, Get the ID number of the new child record, Close the parent form, Re-Open the parent form, Fetch the original parent record, activate the browse.
Anybody know a better way?? Perhaps another version of a query? (Note: it would be greatly preferred that the query not limit the parent records.)
Comment