Re: Refresh Display function not as I thought
G,
Your method will work. Essentially you are opening the table separately, adding or modifying the records, then rerunning a query on the form. This is also the technique presented by Peter Wayne in his discussion on refreshing browses. (I don't have the exact name or link.)
The query in your example simply filters all records (.T.), however, that may not always be the case and can result in two issues: (1) a noticeable time delay on very large tables - especially if the filter is such that it can't use LQO, and (2) the user has to be able to set up the filter correctly when rebuilding the query. Of course, the function "Current_filter_expression()" can be used but the user has to understand that it's there and how to use it.
As I said earlier, it can be done more easily by NOT opening the table in a separate "session".
In your example, you can change this in the inline xbasic:
t=table.open("metals")
to
t = parentform:tables:metals.this
and delete the line "t.close()" since you can't close the table session for the currently opened form.
Finally, delete the query. It isn't needed.
I know this works. I tested it in your app by updating record 3(?) and a couple others I created myself just to be sure.
G,
Your method will work. Essentially you are opening the table separately, adding or modifying the records, then rerunning a query on the form. This is also the technique presented by Peter Wayne in his discussion on refreshing browses. (I don't have the exact name or link.)
The query in your example simply filters all records (.T.), however, that may not always be the case and can result in two issues: (1) a noticeable time delay on very large tables - especially if the filter is such that it can't use LQO, and (2) the user has to be able to set up the filter correctly when rebuilding the query. Of course, the function "Current_filter_expression()" can be used but the user has to understand that it's there and how to use it.
As I said earlier, it can be done more easily by NOT opening the table in a separate "session".
In your example, you can change this in the inline xbasic:
t=table.open("metals")
to
t = parentform:tables:metals.this
and delete the line "t.close()" since you can't close the table session for the currently opened form.
Finally, delete the query. It isn't needed.
I know this works. I tested it in your app by updating record 3(?) and a couple others I created myself just to be sure.
Comment