I am trying to create a model similar to Quickbooks' payment form. When you enter a payment for a customer, all the unpaid invoices appear in the browse. When the form is fetched, you still see the linked invoice that was paid along with the other open invoices for that customer. My idea on accomplishing this was to create a filter for the form and matching index for the child table using:
(PMT_ID = VAR->GETLINK) .OR. (PMT_ID = '' ")
The parent links to the child on CUST_ID which would show all invoices paid or not, so the filter on the form is to only show those that match the current payment or have no payment yet. This seems like it ought to work. The global variable is set to the parent's PMT_ID value in the OnInit event and OnFetch events for the form, but is not displaying correctly in the browse as it fetches each record.
Actually my set links are to show a many to many relationship
PAYMENT
|===INV_PMT
. . . .|---INV_HDR
The browse displays records from both INV_PMT and INV_HDR with INV_PMT as the go between. The form's filter is for the INV_PMT table. If I don't add a sort order for the INV_PMT table it works better but still not consistently. What I am getting is a link displaying when the PMT_ID does not match the parent PMT_ID - the very thing I am trying to filter out! Any ideas on a better way to do this?
Note: The parent table also has a filter set in the form, since you cannot put a filter in the set for the primary table. That filter is
PAY_TYPE = "PMT"
That filter seems to work fine.
UPDATE: I guess I am tired. After reading posts back to 2003 I thought it couldn't hurt to compact the tables (again) and rebuild indexes. In looking at the index and filter I decided to take out all the blank spaces and guess what? It works now. I was also having trouble getting the calcs for the form to display correctly and fixed that by adding a field that could be changed and saved on each fetch. I am curious though how well that will work when there are more records in the table.
(PMT_ID = VAR->GETLINK) .OR. (PMT_ID = '' ")
The parent links to the child on CUST_ID which would show all invoices paid or not, so the filter on the form is to only show those that match the current payment or have no payment yet. This seems like it ought to work. The global variable is set to the parent's PMT_ID value in the OnInit event and OnFetch events for the form, but is not displaying correctly in the browse as it fetches each record.
Actually my set links are to show a many to many relationship
PAYMENT
|===INV_PMT
. . . .|---INV_HDR
The browse displays records from both INV_PMT and INV_HDR with INV_PMT as the go between. The form's filter is for the INV_PMT table. If I don't add a sort order for the INV_PMT table it works better but still not consistently. What I am getting is a link displaying when the PMT_ID does not match the parent PMT_ID - the very thing I am trying to filter out! Any ideas on a better way to do this?
Note: The parent table also has a filter set in the form, since you cannot put a filter in the set for the primary table. That filter is
PAY_TYPE = "PMT"
That filter seems to work fine.
UPDATE: I guess I am tired. After reading posts back to 2003 I thought it couldn't hurt to compact the tables (again) and rebuild indexes. In looking at the index and filter I decided to take out all the blank spaces and guess what? It works now. I was also having trouble getting the calcs for the form to display correctly and fixed that by adding a field that could be changed and saved on each fetch. I am curious though how well that will work when there are more records in the table.