Thursday, March 22, 2012
Dataset manipulation questions
cumulative of all values that I need to report against. The problem is
that I need DISTINCT results of certain columns. To do it within the
sproc would take a prohibitively long time and it would be ideal if I
could do it within the table object on the layout tab. I have played
around with the filtering capabilities in the table properties, but
they are very limited. Is there any way I can produce a DISTINCT list
within the results of a dataset?
Thanks in advance for any help or guidance.
...ChrisMy suggestion is to have your result in the stored procedure to be put into
a temp table. Have an extra field to store the distinct results and then
update the field with the distinct values. I guarantee you this will be
faster than anything RS can do (plus I don't know how to do what you want in
RS).
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<craniumgroup@.gmail.com> wrote in message
news:1116866722.102195.305620@.g14g2000cwa.googlegroups.com...
>I have a dataset that is created by a Stored Procedure that is
> cumulative of all values that I need to report against. The problem is
> that I need DISTINCT results of certain columns. To do it within the
> sproc would take a prohibitively long time and it would be ideal if I
> could do it within the table object on the layout tab. I have played
> around with the filtering capabilities in the table properties, but
> they are very limited. Is there any way I can produce a DISTINCT list
> within the results of a dataset?
> Thanks in advance for any help or guidance.
> ...Chris
>
Dataset Manipulation
Have an XML file that i load in to a Dataset. works fine, it builds its own scheme perfectly.
I loop through that data to load a check list which also works wonderfully.
two questions based on that.
1) can i add a column after the fact? I want to basically update the the info in the dataset to store if the record was checked in the check list. if not, i can manipulate one of the already defined columns, but i would rather not.
2) what is the best way to update data with in the dataset? Never really done anything but pull data from one. how do i locate the correct row to update ("select name from tbl where name = " + checklist.items[index].tostring(); update row)
sorry for the fairly basic question. i appreciate the help.
Justin
re #1: You can add columns to dataset tables at any time.
DataColumn _dc =newDataColumn("newcolumnname");mydataset.Tables[0].Columns.Add(_dc);
re #2: You are asking more than just updating. You are asking how to find the row to update as well.
Create a DataView object to pass in QueryStatements to find the records you want.
Then edit the field value, something such as:
"newcolumnname"] ="newvalue";mydataset.Tables[0].Rows[4][
mydataset.AcceptChanges();
|||great, thanks. not really shore how i missed the column.add, i was even looking for that...
I found something else i might try for the locate and update. because it reads from an XML with no schema it doesnt create a PK. I was going to set a PK (MyDataTable.PrimaryKey = PKColumn) and then use the Find method to locate the row i want (myDataTable.Rows.Find(objValue))
not sure how it will workout, going to give it a try. if not i can do as you suggested.
I appreciate the help.
Thanks
Justin