Filtering concept - Not really but not sure what else to a call it.

H

hartbypass

Hello,

I'll try to explain this the best I can. I am using VS2005/c# and this
is a web app. I have some data in the format of:

Ford Focus 2000
Ford Focus 2001
Ford Focus 2002
Ford Mustang 2004
Ford Mustang 2005
Dodge Ram 2003
Dodge Ram 2004
Dodge Ram 2005
Dodge Ram 2006

I am trying to create an XML file from this data that would look
something like.

<subgroup1 text = "Ford">
<subgroup2 text = "Focus">
<subgroup2a text = "2000">
</subgroup2a>
<subgroup2b text = "2001">
</subgroup2b>
</subgroup2>
</subgroup1>

I was thinking I would need to create something like three variables
and then loop through it and see if the next line of data matched the
previous and if not what value changed. I am just wondering if there
is a better way.

Thanks,
Greg
 
P

Peter Bradley

Wouldn't a better XML structure look more like:

<cars>
<car>
<make>Ford</make>
<model>Focus</model>
<year>2000</year>
</car>
<car>
<make>Ford</make>
<model>Focus</model>
<year>2001></year>
</car>
<car>
 
D

Duggi

Hi

Lets make the thing simple....Move data to a DBTable.... to get it
filtered... SELECT * from table WHERE ****

Hope you like it...

Thanks
-Srinivas.
 
H

hartbypass

Thanks for the fast responses.

The data is in a database already, the end result it that I am trying
to stick it in to the tree control. So the suggested xml structures
will not work for what I need. I need to be able to See all the fords
under the ford branch and then all the focus' under the focus branch
that is under the ford branch. I guess I was looking more for code to
parse that data than suggestions on better formatting XML. Sorry if I
was not clear.

Thanks,
Greg
 
H

hartbypass

Thanks for the fast responses.

The data is in a database already, the end result it that I am trying
to stick it in to the tree control. So the suggested xml structures
will not work for what I need. I need to be able to See all the fords
under the ford branch and then all the focus' under the focus branch
that is under the ford branch. I guess I was looking more for code to
parse that data than suggestions on better formatting XML. Sorry if I
was not clear.

Thanks,
Greg
 
D

Duggi

Got it....

You can do a query of data base with ORDERBY ....

SELECT "column_name"
FROM "table_name"
[WHERE "condition"]
ORDER BY "column_name" [ASC, DESC]

this will sort all the rows.. where ever there is a change in the
cartype come back to root node... Will this help???

I think you can also bind the data to the control.. with data binding
feature....Ofcourse after ORDERBY.

Thanks
-Srinivas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top