473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Retrieve info from Dataset with Relations (Dataset,SQL or XML)

Joe
Hi

I am going to receive a dataset downstream and I will not know the
the fields
number of field
relations
number of relations

So I have to be flexible to take unknown data and be able to summarize all
the info being passed
I have included an example

I don't know what is the best way to attack this

XML and Xpath using the XSD as a guide?? I am not too familiar with what the
xsd is giving me
If I know how many tables and what field to xpath to the different levels
???

Dataset and walk the relations?? But they are at different levels
Every row get another row collection with the GetChild depending on the
number of relations
They cascade or are nested

What I want to see is
GM Pontiac GTO 82 4
GM Pontiac Gand Prix 134 38
GM Pontiac 1130 630
....
....

GM Buick 294 84
GM 43310 9880


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<l1>
<ID>Total</ID>
<Company>GM</Company>
<Sum_x0020_of_x0020_HoursDev>43310</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>9880</Sum_x0020_of_x0020_MarketLife>
</l1>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Sum_x0020_of_x0020_HoursDev>1130</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>630</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Buick</Division>
<Sum_x0020_of_x0020_HoursDev>294</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>84</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Cadillac</Division>
<Sum_x0020_of_x0020_HoursDev>5658</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>2038</Sum_x0020_of_x0020_MarketLife>
</l2>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>GTO</Car>
<Sum_x0020_of_x0020_HoursDev>82</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>4</Sum_x0020_of_x0020_MarketLife>
</l3>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>Grand Prix</Car>
<Sum_x0020_of_x0020_HoursDev>134</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>38</Sum_x0020_of_x0020_MarketLife>
</l3>
<NewDataSet>

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="vDWHPat">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l1">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l2">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l3">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="MainDepartment" type="xs:string"
minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//Table" />
<xs:field xpath="ID" />
</xs:unique>
<xs:unique name="l1_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:unique>
<xs:unique name="l2_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:unique>
<xs:keyref name="l2" refer="l2_Constraint1">
<xs:selector xpath=".//l3" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:keyref>
<xs:keyref name="l1" refer="l1_Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:keyref>
<xs:keyref name="l0" refer="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
</xs:keyref>
</xs:element>
</xs:schema>
Apr 4 '06 #1
2 2471
Joe,

I definitely would not use XML/XPath for this. I would just cycle
through all of the relations for each row as you cycle through the tables.
It's just a few calls in a loop as you iterate through the rows.

Hope this helps.
"Joe" <hc******@yahoo.com> wrote in message
news:Oi******************@TK2MSFTNGP15.phx.gbl...
Hi

I am going to receive a dataset downstream and I will not know the
the fields
number of field
relations
number of relations

So I have to be flexible to take unknown data and be able to summarize all
the info being passed
I have included an example

I don't know what is the best way to attack this

XML and Xpath using the XSD as a guide?? I am not too familiar with what
the xsd is giving me
If I know how many tables and what field to xpath to the different levels
???

Dataset and walk the relations?? But they are at different levels
Every row get another row collection with the GetChild depending on the
number of relations
They cascade or are nested

What I want to see is
GM Pontiac GTO 82 4
GM Pontiac Gand Prix 134 38
GM Pontiac 1130 630
...
...

GM Buick 294 84
GM 43310 9880


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<l1>
<ID>Total</ID>
<Company>GM</Company>
<Sum_x0020_of_x0020_HoursDev>43310</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>9880</Sum_x0020_of_x0020_MarketLife>
</l1>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Sum_x0020_of_x0020_HoursDev>1130</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>630</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Buick</Division>
<Sum_x0020_of_x0020_HoursDev>294</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>84</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Cadillac</Division>
<Sum_x0020_of_x0020_HoursDev>5658</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>2038</Sum_x0020_of_x0020_MarketLife>
</l2>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>GTO</Car>
<Sum_x0020_of_x0020_HoursDev>82</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>4</Sum_x0020_of_x0020_MarketLife>
</l3>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>Grand Prix</Car>
<Sum_x0020_of_x0020_HoursDev>134</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>38</Sum_x0020_of_x0020_MarketLife>
</l3>
<NewDataSet>

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="vDWHPat">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l1">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l2">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l3">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="MainDepartment" type="xs:string"
minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//Table" />
<xs:field xpath="ID" />
</xs:unique>
<xs:unique name="l1_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:unique>
<xs:unique name="l2_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:unique>
<xs:keyref name="l2" refer="l2_Constraint1">
<xs:selector xpath=".//l3" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:keyref>
<xs:keyref name="l1" refer="l1_Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:keyref>
<xs:keyref name="l0" refer="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
</xs:keyref>
</xs:element>
</xs:schema>


Apr 4 '06 #2
Joe,

I definitely would not use XML/XPath for this. I would just cycle
through all of the relations on each row as you cycle through the tables.
It's just a few calls in a loop as you iterate through the rows.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Joe" <hc******@yahoo.com> wrote in message
news:Oi******************@TK2MSFTNGP15.phx.gbl...
Hi

I am going to receive a dataset downstream and I will not know the
the fields
number of field
relations
number of relations

So I have to be flexible to take unknown data and be able to summarize all
the info being passed
I have included an example

I don't know what is the best way to attack this

XML and Xpath using the XSD as a guide?? I am not too familiar with what
the xsd is giving me
If I know how many tables and what field to xpath to the different levels
???

Dataset and walk the relations?? But they are at different levels
Every row get another row collection with the GetChild depending on the
number of relations
They cascade or are nested

What I want to see is
GM Pontiac GTO 82 4
GM Pontiac Gand Prix 134 38
GM Pontiac 1130 630
...
...

GM Buick 294 84
GM 43310 9880


<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<l1>
<ID>Total</ID>
<Company>GM</Company>
<Sum_x0020_of_x0020_HoursDev>43310</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>9880</Sum_x0020_of_x0020_MarketLife>
</l1>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Sum_x0020_of_x0020_HoursDev>1130</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>630</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Buick</Division>
<Sum_x0020_of_x0020_HoursDev>294</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>84</Sum_x0020_of_x0020_MarketLife>
</l2>
<l2>
<ID>Total</ID>
<Company>GM</Company>
<Division>Cadillac</Division>
<Sum_x0020_of_x0020_HoursDev>5658</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>2038</Sum_x0020_of_x0020_MarketLife>
</l2>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>GTO</Car>
<Sum_x0020_of_x0020_HoursDev>82</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>4</Sum_x0020_of_x0020_MarketLife>
</l3>
<l3>
<ID>Total</ID>
<Company>GM</Company>
<Division>Pontiac</Division>
<Car>Grand Prix</Car>
<Sum_x0020_of_x0020_HoursDev>134</Sum_x0020_of_x0020_HoursDev>
<Sum_x0020_of_x0020_MarketLife>38</Sum_x0020_of_x0020_MarketLife>
</l3>
<NewDataSet>

<?xml version="1.0" standalone="yes"?>
<xs:schema id="NewDataSet" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="vDWHPat">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l1">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l2">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="l3">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" type="xs:string" minOccurs="0" />
<xs:element name="Company" type="xs:string" minOccurs="0" />
<xs:element name="Division" type="xs:string" minOccurs="0" />
<xs:element name="MainDepartment" type="xs:string"
minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_HoursDev"
type="xs:double" minOccurs="0" />
<xs:element name="Sum_x0020_of_x0020_MarketLife"
type="xs:double" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
<xs:unique name="Constraint1">
<xs:selector xpath=".//Table" />
<xs:field xpath="ID" />
</xs:unique>
<xs:unique name="l1_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:unique>
<xs:unique name="l2_Constraint1" msdata:ConstraintName="Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:unique>
<xs:keyref name="l2" refer="l2_Constraint1">
<xs:selector xpath=".//l3" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
<xs:field xpath="Division" />
</xs:keyref>
<xs:keyref name="l1" refer="l1_Constraint1">
<xs:selector xpath=".//l2" />
<xs:field xpath="ID" />
<xs:field xpath="Company" />
</xs:keyref>
<xs:keyref name="l0" refer="Constraint1">
<xs:selector xpath=".//l1" />
<xs:field xpath="ID" />
</xs:keyref>
</xs:element>
</xs:schema>

Apr 4 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bill C. | last post by:
Hi, I've got a simple console app that just reads an XML file into a DataSet then prints out a description of each table in the DataSet, including column names and row values for each column. ...
0
by: Frosty | last post by:
Hi I am using the VS xsd designer to create a strongly typed dataset. The dataset is apparently successfully created, with no warnings or errors given. Is it not then to be expected that this...
2
by: James Ankrom | last post by:
Why does this fail? Dim relResources As New Data.DataRelation("Application_Resources", ..Tables("User_Applications").Columns("Application_id"),...
2
by: Dennis | last post by:
Hi, I am hoping I can get some help with a small problem I have run into using C#. U have an XML file that I load into a Dataset and then display this in a Datagrid. No problems doing this at all....
9
by: Dave | last post by:
Compilier will not recognize DataSet object. As you can see below is from a test simple form with no other code. I'm just trying to get any Aspx form to recognize the DataSet object. You can...
0
by: Steve | last post by:
I have a dataset. I fill it with two recordsets from SQL queries. Tables are called tblPlanFYSpendingStage, tblSpendingStage.
1
by: DaveF | last post by:
How can I retrieve display_names Dim custDS As DataSet = New DataSet Dim mySQL, mySQL2, mySQL3 As String
3
by: Joe | last post by:
Hi I have a dataset with 2 tables and Relations What is the best way to flatten the 2 files to a new table or xml or file I can loop thru table1 and get the childrows or I can do an Xpath on...
2
by: Joe | last post by:
Hi I have a dataset with 3 tables and 2 relations Is there a way to when I am at 1 row to tell if there is a relation on that row ??? I have the code hardcoded but try to make it work if the #...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.