Showing posts with label items. Show all posts
Showing posts with label items. Show all posts

Friday, March 30, 2012

load CatalogItem array in treeview

Hi,

i would like to load my array 'items' in a treeview

CatalogItem[] items = rs.ListChildren("/", true);

is there anyway that automatically does the layout or do i have to check what the type is of everey object so I can indent correctly.

thanks
I'm really looking for this one :).

I'm trying to do it manually but I can't find a way to get the reports in the right structure. I'll show what I want to accomplish and how I am trying it now:

WANTED LIST:
+ Adventureworks
- Company Sales
- Employee Sales Summary
+ Subfolder
- Report from subfolder
- Report from subfolder

Code trying to get there (not thinking of subfolders yet):

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
CatalogItem[] items = rs.ListChildren("/", false);
foreach (CatalogItem ci in items)
{
cmbRapporten.Nodes.Add(ci.Name);
CatalogItem[] test = rs.ListChildren("/" + ci.Name.ToString(), false);
foreach(CatalogItem ti in test)
{
cmbRapporten.Nodes.Add(ti.Name);
}
}
EXPLANATION

I ask for the root folder's children (not recursive) and then list them in my treeview cmbRapporten then I create a new CatalogItem[] = test, where I list the children of the current folder in the CatalogItem[] items. Everything appears fine but it's all in one line down. How do I couple them with their parents folder.

greetings
|||Hi,

so I got there to fill the treeview not looking at subfolders with this code (pretty simple if you ask me ;))

[CODE]
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
CatalogItem[] items = rs.ListChildren("/", false);
foreach (CatalogItem item in items)
{
cmbRapporten.Nodes.Add(item.Name);
if (item.Type.ToString() == "Folder")
{
CatalogItem[] childs = rs.ListChildren("/" + item.Name.ToString(), false);
foreach (CatalogItem child in childs)
{
cmbRapporten.Nodes[counter].Nodes.Add(child.Name);
}
counter++;
}
}
[/CODE]

Gives me a nice treeview in the designer but I'm still not content ;).

If one of the items in the object childs is a folder then there should be added another subnode. I'll visualize it for better understanding:

Now i support:

+ FOLDER
-REPORT
-REPORT
-SUBFOLDER
-REPORT

But I want the subfolder to display it's items too. So I will have to make a generic method and then call it with two parameters i thought. The string path wich is the path on the report server that should List it's children. Second of al I have to pass the Node number. But sometimes I will have to pass one node number while other times I will have to pass multiple node numbers... I have no idea to make such an method. Could somebody help with this.

Do I make sense or should I rephrase everything.

Greetings

Monday, March 19, 2012

List SSRS2005 items on treeview

Hi all,

I'm creating a Custom web interface for SQL Server reporting services 2005.

What I want to do is populate a "Navigation Treeview" component in asp.net 2. How would I get all the catalog items and items from the web API and populate my treeview?

Thanks

Hi Rudi,

You could use the SOAP API - ListChildren. Here is a link to defintion and code sample:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_ref_soapapi_service_lz_2yt2.asp

|||

Hi there Brad,

Thanks alot! I'm still having some trouble though...

I'm using this code to get the list:

Try

Dim P As New ReportingService

Dim RootList As CatalogItem = P.ListChildren("/", True)

LoadTree(RootList)

Catch ex As Exception

End Try

But this is returning the error:

\\Reportserver\NetReports\Admin\Default.aspx(1): Build (web): \\Reportserver\NetReports\MasterPage.master.vb(36): error BC30311: Value of type '1-dimensional array of ReportService.CatalogItem' cannot be converted to 'ReportService.CatalogItem'.

What am I doing wrong?

Thanks

|||

Don't worry, I got it....

I didn't add the () in

Dim RootList As CatalogItem() = rs.ListChildren("/", True)

Thanks

|||Any chance you could provide the code used for LoadTree? I'm stuck trying to figure out how to programmatically build the nodes from the CatalogItem.

Thanks,
Kel

List SSRS2005 items on treeview

Hi all,

I'm creating a Custom web interface for SQL Server reporting services 2005.

What I want to do is populate a "Navigation Treeview" component in asp.net 2. How would I get all the catalog items and items from the web API and populate my treeview?

Thanks

Hi Rudi,

You could use the SOAP API - ListChildren. Here is a link to defintion and code sample:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/RSPROG/htm/rsp_ref_soapapi_service_lz_2yt2.asp

|||

Hi there Brad,

Thanks alot! I'm still having some trouble though...

I'm using this code to get the list:

Try

Dim P As New ReportingService

Dim RootList As CatalogItem = P.ListChildren("/", True)

LoadTree(RootList)

Catch ex As Exception

End Try

But this is returning the error:

\\Reportserver\NetReports\Admin\Default.aspx(1): Build (web): \\Reportserver\NetReports\MasterPage.master.vb(36): error BC30311: Value of type '1-dimensional array of ReportService.CatalogItem' cannot be converted to 'ReportService.CatalogItem'.

What am I doing wrong?

Thanks

|||

Don't worry, I got it....

I didn't add the () in

Dim RootList As CatalogItem() = rs.ListChildren("/", True)

Thanks

|||Any chance you could provide the code used for LoadTree? I'm stuck trying to figure out how to programmatically build the nodes from the CatalogItem.

Thanks,
Kel

Monday, March 12, 2012

List out duplicate names only

Hi all,
I am new this this site. May I know how do I do a search for duplicate items
in a column of a table only. eg If John appears twice and Jim once, in the
Name column of Student table, the Select statement should show me 2 times (
John ) ?
ThanksSee Itzik Ben-Gan's example
CREATE TABLE #Demo (
idNo int identity(1,1),
colA int,
colB int
)
INSERT INTO #Demo(colA,colB) VALUES (1,6)
INSERT INTO #Demo(colA,colB) VALUES (1,6)
INSERT INTO #Demo(colA,colB) VALUES (2,4)
INSERT INTO #Demo(colA,colB) VALUES (3,3)
INSERT INTO #Demo(colA,colB) VALUES (4,2)
INSERT INTO #Demo(colA,colB) VALUES (3,3)
INSERT INTO #Demo(colA,colB) VALUES (5,1)
INSERT INTO #Demo(colA,colB) VALUES (8,1)
PRINT 'Table'
SELECT * FROM #Demo
PRINT 'Duplicates in Table'
SELECT * FROM #Demo
WHERE idNo IN
(SELECT B.idNo
FROM #Demo A JOIN #Demo B
ON A.idNo <> B.idNo
AND A.colA = B.colA
AND A.colB = B.colB)
PRINT 'Duplicates to Delete'
SELECT * FROM #Demo
WHERE idNo IN
(SELECT B.idNo
FROM #Demo A JOIN #Demo B
ON A.idNo < B.idNo -- < this time, not <>
AND A.colA = B.colA
AND A.colB = B.colB)
DELETE FROM #Demo
WHERE idNo IN
(SELECT B.idNo
FROM #Demo A JOIN #Demo B
ON A.idNo < B.idNo -- < this time, not <>
AND A.colA = B.colA
AND A.colB = B.colB)
PRINT 'Cleaned-up Table'
SELECT * FROM #Demo
DROP TABLE #Demo
"Eric_Singapore" <Eric_Singapore.24lr9q@.mail.codecomments.com> wrote in
message news:Eric_Singapore.24lr9q@.mail.codecomments.com...
> Hi all,
> I am new this this site. May I know how do I do a search for duplicate
> items in a column of a table only. eg If John appears twice and Jim
> once, in the Name column of Student table, the Select statement should
> show me 2 times ( John ) ?
>
> Thanks
>
> --
> Eric_Singapore
> ---
> Posted via http://www.codecomments.com
> ---
>