Order by field after merging 2 datasets together.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello all -

I'm at wits end with this problem that I'm trying to figure out and I was hoping someone could help me who is more of an expert than I am. I have 2 separate datasets that come from separate databases that I merge together into 1 dataset. First when they are set up in their own datasets, called dsA and dsB, they are ordered by a date field. When I merge them together, I need for them to be re-ordered again by the <Date> field that they both have in common but can't figure out the method to do that. Can any one help me out?

BIG thanks
Mark
 
Mark,

Create a dataview bound to the table in the final merged dataset, then use
dataview.sort method to sort the data.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemDataDataViewClassTopic.asp

HTH,

Raymond Lewallen

Mark said:
Hello all -

I'm at wits end with this problem that I'm trying to figure out and I was
hoping someone could help me who is more of an expert than I am. I have 2
separate datasets that come from separate databases that I merge together
into 1 dataset. First when they are set up in their own datasets, called
dsA and dsB, they are ordered by a date field. When I merge them together,
I need for them to be re-ordered again by the <Date> field that they both
have in common but can't figure out the method to do that. Can any one help
me out??
 
Hi, Mark

You can try to sort the default view of the datatable of the merged dataset
dsMerged.Tables(0).DefaultView.Sort = "DateField

Bin Song, MC

----- Mark wrote: ----

Hello all -

I'm at wits end with this problem that I'm trying to figure out and I was hoping someone could help me who is more of an expert than I am. I have 2 separate datasets that come from separate databases that I merge together into 1 dataset. First when they are set up in their own datasets, called dsA and dsB, they are ordered by a date field. When I merge them together, I need for them to be re-ordered again by the <Date> field that they both have in common but can't figure out the method to do that. Can any one help me out?

BIG thanks
Mark
 
Thank you for your thoughts. My only problem that I see since I did have the code in place for that is I'm trying to display this data within a Crystal Report, where the report's source is a dataset. Implications on my data being a dataview and not a dataset?? My feeling is that since it's a different object, it won't take and I'm not aware of being able to set a Crystal Report to a dataview in ASP.Net

Thoughts??

Thanks
Mar

----- Raymond Lewallen wrote: ----

Mark

Create a dataview bound to the table in the final merged dataset, then us
dataview.sort method to sort the data
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html
frlrfSystemDataDataViewClassTopic.as

HTH

Raymond Lewalle

Mark said:
Hello all
hoping someone could help me who is more of an expert than I am. I have
separate datasets that come from separate databases that I merge togethe
into 1 dataset. First when they are set up in their own datasets, calle
dsA and dsB, they are ordered by a date field. When I merge them together
I need for them to be re-ordered again by the <Date> field that they bot
have in common but can't figure out the method to do that. Can any one hel
me out?
 
Mark,

Try Bin Song's suggestion with the default data view:
Hi, Mark,

You can try to sort the default view of the datatable of the merged dataset.
dsMerged.Tables(0).DefaultView.Sort = "DateField"

Bin Song, MCP

Mark said:
Thank you for your thoughts. My only problem that I see since I did have
the code in place for that is I'm trying to display this data within a
Crystal Report, where the report's source is a dataset. Implications on my
data being a dataview and not a dataset?? My feeling is that since it's a
different object, it won't take and I'm not aware of being able to set a
Crystal Report to a dataview in ASP.Net.
 
Actually, I attemped this early on and didn't have any success with exploring that option. If anybody has encountered with trying to get this to work with datasets for Crystal Reports, I would appreciate any insight

THanks
Mar
----- Raymond Lewallen wrote: ----

Mark

Try Bin Song's suggestion with the default data view
Hi, Mark dataset
dsMerged.Tables(0).DefaultView.Sort = "DateField

Mark said:
Thank you for your thoughts. My only problem that I see since I did hav
the code in place for that is I'm trying to display this data within
Crystal Report, where the report's source is a dataset. Implications on m
data being a dataview and not a dataset?? My feeling is that since it's
different object, it won't take and I'm not aware of being able to set
Crystal Report to a dataview in ASP.Net
 
I am not farmiliar with Crystal Report. Why not try SortField of Crystal Report object
Report.DateDefinition.SortFields.
I am not sure if it works or not

Bin Song, MC

----- Mark wrote: ----


Actually, I attemped this early on and didn't have any success with exploring that option. If anybody has encountered with trying to get this to work with datasets for Crystal Reports, I would appreciate any insight

THanks
Mar
----- Raymond Lewallen wrote: ----

Mark

Try Bin Song's suggestion with the default data view
Hi, Mark dataset
dsMerged.Tables(0).DefaultView.Sort = "DateField

Mark said:
Thank you for your thoughts. My only problem that I see since I did hav
the code in place for that is I'm trying to display this data within
Crystal Report, where the report's source is a dataset. Implications on m
data being a dataview and not a dataset?? My feeling is that since it's
different object, it won't take and I'm not aware of being able to set
Crystal Report to a dataview in ASP.Net
 
Bin

Thank you for your help. There is an option that I wasn't aware with my novice exposure with Crystal .NET called "Sort Records". Even though I had pre-defined dynamic groupings, if I selected an item 'Date' from my dataset record source and added it after the previous two, the data within each employee will be sorted appropriately by date (descending or ascending) whichever you select

I appreciate everybody's opinions but of course, something that took forever to find I found through help in 5 minutes

Mar
----- Bin Song, MCP wrote: ----

I am not farmiliar with Crystal Report. Why not try SortField of Crystal Report object
Report.DateDefinition.SortFields.
I am not sure if it works or not

Bin Song, MC

----- Mark wrote: ----


Actually, I attemped this early on and didn't have any success with exploring that option. If anybody has encountered with trying to get this to work with datasets for Crystal Reports, I would appreciate any insight

THanks
Mar
----- Raymond Lewallen wrote: ----

Mark

Try Bin Song's suggestion with the default data view
Hi, Mark dataset
dsMerged.Tables(0).DefaultView.Sort = "DateField

Mark said:
Thank you for your thoughts. My only problem that I see since I did hav
the code in place for that is I'm trying to display this data within
Crystal Report, where the report's source is a dataset. Implications on m
data being a dataview and not a dataset?? My feeling is that since it's
different object, it won't take and I'm not aware of being able to set
Crystal Report to a dataview in ASP.Net
 
Back
Top