Home All Groups Group Topic Archive Search About

Typed Dataset. Filtering/Selecting

Author
2 Mar 2007 8:02 AM
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>

Author
2 Mar 2007 5:13 PM
Miha Markic [MVP C#]
Hi Allan,

Perhaps you want to query a dataset?
http://cs.rthand.com/blogs/blog_with_righthand/archive/2007/02/21/QueryADataset.aspx

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Show quote
"Allan Bredahl" <a**@senseit.dk> wrote in message
news:uGhOqEKXHHA.5092@TK2MSFTNGP03.phx.gbl...
> 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>
>

AddThis Social Bookmark Button