I have not been able to formulate (what should have been) a simple query expression to select parent records based upon their child records. I�m sure that there is a simple answer. The problem will be easier to describe using the AlphaSports application.
In the User Guide (p. 93-94) cross-level queries are described as filtering out records at the parent level of the set. �� using the invoice form in the sample AlphaSports database application, you can use a Cross-Level Query to answer the question, �show me all invoices that include �UnoFold Dry Socks� as a line item.�
This is simple enough and I am able to do the same thing with both AlphaSports as well as my own application. However, I want to answer a similar, but different question, �show me all invoices that exclude �UnoFold Dry Socks� as a line item.� In other words, I do not want to see any invoices (parent records) that include �UnoFold Dry Socks� in a line item.
Using the query genie, I checked the �Exclude records that satisfy this condition� box. This generated the following expression: .not.((("UnoFold" $ Product->Description)))
However, when I run this query all records are selected, including those that include �UnoFold Dry Socks�.
(Conversely, if I do not check the �exclude� box, only invoice #s 000013, 16, 18, 27, 28 that include �UnoFold Dry Socks� are displayed.) Curiously, when I use the same kind of expression with my own application, the �line items� that should be excluded are excluded, even though the parent records are still selected.)
So, either I have misunderstood how to use cross-level queries, or perhaps there is an alternate way to achieve the same result. In either case, I would appreciate any suggestions.
In the User Guide (p. 93-94) cross-level queries are described as filtering out records at the parent level of the set. �� using the invoice form in the sample AlphaSports database application, you can use a Cross-Level Query to answer the question, �show me all invoices that include �UnoFold Dry Socks� as a line item.�
This is simple enough and I am able to do the same thing with both AlphaSports as well as my own application. However, I want to answer a similar, but different question, �show me all invoices that exclude �UnoFold Dry Socks� as a line item.� In other words, I do not want to see any invoices (parent records) that include �UnoFold Dry Socks� in a line item.
Using the query genie, I checked the �Exclude records that satisfy this condition� box. This generated the following expression: .not.((("UnoFold" $ Product->Description)))
However, when I run this query all records are selected, including those that include �UnoFold Dry Socks�.
(Conversely, if I do not check the �exclude� box, only invoice #s 000013, 16, 18, 27, 28 that include �UnoFold Dry Socks� are displayed.) Curiously, when I use the same kind of expression with my own application, the �line items� that should be excluded are excluded, even though the parent records are still selected.)
So, either I have misunderstood how to use cross-level queries, or perhaps there is an alternate way to achieve the same result. In either case, I would appreciate any suggestions.
Comment