Typed Dataset. Filtering/Selecting

  • Thread starter Thread starter Allan Bredahl
  • Start date Start date
A

Allan Bredahl

Hi all

I'm in the process of making a system to integrate a webshop with an erp
system. All exports from the erp are XML based, and when I needed a test
application the obvious choice for me was to use XSD generated from the XML
export files, and from the XSD to generat Typed Datasets.

This works just great, and gives me a world of possibilities for
manipulating the data and binding it to different controls.

Or so I thought, cause I feel that I miss some key concepts about filtering
the Typed Datasets. In the bottom of this post you can se a simplified XSD
for my Typed Dataset


The DataSet contains a "Products" table that has a child "Product" table

The "Product" table has zero to any "LinkedLevel" related through a
"LinkedLevels" table

On the other side "Product" is related to a "Common" table through the
"Properties" table.


"Products"
|
"Common" ------> "Properties" ----> "Product" <----- "LinkedLevels" <-----
"LinkedLevel"


Now I make a databinding of a grid to the "Common" table, and this shows me
the "Common" properties of all the products just as I want:

this.dgvItems.DataSource = Dataset.Common


BUT

Now I want to filter this view, so I only show the "Properties" -->
"Common", for the "Products" that has a related "LinkedLevel" with Id=1000

How do I do this. Have been searching franticly but with no usefull results.


Any hint will be much appreciated.

Thanks in advance

Allan Bredahl

<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="DSCatalog" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="Catalog">
<xs:complexType>
<xs:sequence>
<xs:element name="Products" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Product" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="LinkedLevels" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="LinkedLevel" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:attribute name="Id" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="Properties" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Common" minOccurs="0"
maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="Description"
type="xs:string" minOccurs="0" />
<xs:element name="Description2"
type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Id" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DSCatalog" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="Catalog" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
 
Back
Top