Hello, I have a problem that's been driving me nuts. I'm
creating typed DataSets, but I can't seem to get an
expression column to work properly if it is using data
from a child column. Using Parent in an expression on the
child table works, as well as using GetChildRows from a
data row. However, querying the column for that row will
always return a null result.
The expression I am using is: "Count(Child
(CustomerInfoAccountNumbers).AccountNumber)"
The names for the relation and child column are correct,
and I always get a null result regardless of what
aggregation expression is used.
The XSD of the data set (named CustomerSearchResults) is:
<?xml version="1.0" standalone="yes" ?>
<xs:schema id="CustomerSearchResults"
targetNamespace="http://www.tempuri.org/CustomerSearchResu
lts.xsd"
xmlns:mstns="http://www.tempuri.org/CustomerSearch
Results.xsd"
xmlns="http://www.tempuri.org/CustomerSearchResults.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
attributeFormDefault="qualified"
elementFormDefault="qualified">
<xs:element name="CustomerSearchResults"
msdata:IsDataSet="true">
<xs:complexType>
<xs:choice maxOccurs="unbounded">
<xs:element
name="CustomerInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID"
msdata:AutoIncrement="true" type="xs:int" minOccurs="0" />
<xs:element name="TaxID" type="xs:string"
minOccurs="0" />
<xs:element name="FirstName" type="xs:string"
minOccurs="0" />
<xs:element name="LastName" type="xs:string"
minOccurs="0" />
<xs:element name="Age" type="xs:int"
minOccurs="0" />
<xs:element name="AccountNumber" type="xs:int"
minOccurs="0" msdata:Expression="Min(Child
(CustomerInfoAccountNumbers).AccountNumber)"
msdata:ReadOnly="true" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element
name="AddressInfo">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID" type="xs:int"
minOccurs="0" />
<xs:element name="AddressID" type="xs:int"
minOccurs="0" />
<xs:element name="Address1" type="xs:string"
minOccurs="0" />
<xs:element name="AddressType" type="xs:string"
minOccurs="0" />
<xs:element name="City" type="xs:string"
minOccurs="0" />
<xs:element name="State" type="xs:string"
minOccurs="0" />
<xs:element name="ZipCode" type="xs:string"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element
name="AccountNumbers">
<xs:complexType>
<xs:sequence>
<xs:element name="CustomerID" type="xs:int"
minOccurs="0" />
<xs:element name="AccountNumber" type="xs:int"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:key name="CustomerSearchResultsKey2"
msdata:PrimaryKey="true">
<xs:selector
xpath=".//mstns:AccountNumbers" />
<xs:field
xpath="mstns:CustomerID" />
<xs:field
xpath="mstns:AccountNumber" />
</xs:key>
<xs:key name="CustomerSearchResultsKey1"
msdata:PrimaryKey="true">
<xs:selector
xpath=".//mstns:CustomerInfo" />
<xs:field
xpath="mstns:CustomerID" />
</xs:key>
<xs:keyref name="CustomerInfoAddressInfo"
refer="mstns:CustomerSearchResultsKey1">
<xs:selector
xpath=".//mstns:AddressInfo" />
<xs:field
xpath="mstns:CustomerID" />
</xs:keyref>
<xs:keyref
name="CustomerInfoAccountNumbers"
refer="mstns:CustomerSearchResultsKey1">
<xs:selector
xpath=".//mstns:AccountNumbers" />
<xs:field
xpath="mstns:CustomerID" />
</xs:keyref>
</xs:element>
</xs:schema>
|