472,989 Members | 2,945 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Web service dataset to pivot

Hi Folks
Can anyone direct me to a simple example of using a pivot table to consume a
dataset from a web service?

Using Web Service Reference Tool, Office 11. Web service comes from .NET
application

Thanks in advance!
Andrew

Jun 12 '06 #1
4 3283
Hi,
Did you find a solution, cause i have the same problem!
Best regards


*** Sent via Developersdex http://www.developersdex.com ***
Jun 19 '06 #2
HI Andrew,

could you go further in your investigation?
Best Regards

*** Sent via Developersdex http://www.developersdex.com ***
Jun 19 '06 #3
Hi, I figured it out, but in a very convoluted way.
Basically, write the contents of the dataset into a worksheet, in my case
called "Work", then construct the pivot table programatically. After all
this, clean the workarea.

I would be very pleased if someone has a shorter, more efficient way to do
this.

Code below: (Note, Office XP Web Services toolkit and Xml Parser 6 must be
installed on user machine to consume the web service and parse the Xml)

Sub Get_A21_Pivot()

On Error GoTo Errhandler

Dim objXmlDoc As New DOMDocument
Dim objNList As IXMLDOMNodeList
Dim objWS As New clsws_TNAService
Dim objTableNodes As IXMLDOMNodeList
Dim objDataNode As IXMLDOMNode
Dim RowCount As Integer
Dim ColCount As Integer
Set objNList = objWS.wsm_Get_A21_Pivot

If Not objNList Is Nothing Then
objXmlDoc.LoadXml objNList(1).XML
Set objTableNodes = objXmlDoc.getElementsByTagName("Table")
If Not objTableNodes Is Nothing Then
RowCount = objTableNodes.Length
If objTableNodes.Length > 0 Then
ColCount = objTableNodes(0).childNodes.Length
Else
MsgBox ("No Data Available For DownLoad."), vbInformation
Exit Sub
End If

If objTableNodes.Length > 0 Then
ColCount = objTableNodes(0).childNodes.Length
Else
MsgBox ("No Data Available For DownLoad."), vbInformation
Exit Sub
End If

Worksheets("Work").Activate
Range("A1") = "#"
Range("b1") = "Occupational Category"
Range("c1") = "Class"
Range("d1") = "Gender"
Range("e1") = "Qty"

For i = 0 To RowCount - 1
Set objDataNode = objTableNodes(i)
For j = 0 To ColCount - 1
Worksheets("Work").Cells(i + 2, j + 1) =
objDataNode.childNodes(j).Text
Next j
Next i

'Make pivot
Worksheets("Section A2").Activate

Dim PTCache As PivotCache
Dim pt As PivotTable

Set PTCache = ActiveWorkbook.PivotCaches.Add _
(SourceType:=xlDatabase, _
SourceData:=Sheets("Work").Range("A1").CurrentRegi on.Address)

Set pt = PTCache.CreatePivotTable _
(TableDestination:="A.2.1.", TableName:="Pivot1")

With pt
.PivotFields(1).Orientation = xlRowField 'Number
.PivotFields(2).Orientation = xlRowField 'Category
.PivotFields(3).Orientation = xlColumnField 'Race
.PivotFields(4).Orientation = xlColumnField 'Gender
.PivotFields(5).Orientation = xlDataField 'Count
End With

'Remove grand totals, set the order of the columns
ActiveSheet.PivotTables("Pivot1").RowGrand = False

ActiveSheet.PivotTables("Pivot1").PivotFields(4).P ivotItems("M").Position = 1

ActiveSheet.PivotTables("Pivot1").PivotFields(4).P ivotItems("F").Position = 2

ActiveSheet.PivotTables("Pivot1").PivotFields(4).P ivotItems("Disabled").Position = 3
Call CleanWorkArea

Else
MsgBox ("No Data Available For DownLoad."), vbInformation
Exit Sub
End If
End If

"Andrew van Zyl" wrote:
Hi Folks
Can anyone direct me to a simple example of using a pivot table to consume a
dataset from a web service?

Using Web Service Reference Tool, Office 11. Web service comes from .NET
application

Thanks in advance!
Andrew

Jun 19 '06 #4
Thank you for your answer!
in fact i am using office web component in IE 6 and not excel. So your
solution is not possible.
and furthermore the owc pivottable has to be create client side. i am
still looking for a solution and for me consuming a web service that
deliver xml data was an elegant solution but i can't figure out how to
connect the two parts join
best regards

*** Sent via Developersdex http://www.developersdex.com ***
Jun 19 '06 #5

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

Similar topics

0
by: Alexander Mandl | last post by:
Hello I have a pivot table in an Access form and open the pivot Table (Excel OLE Object) from within Access. In the Excel Table is a macro (signed) (in teh open event) running when opening the...
4
by: lakshmi | last post by:
Hi all, My requirement is I need to have three different recordsets open at the same time. Traversing through the 3 recordsets, I would check on the data and based on some rules, return an object...
1
by: Bernard O'Flynn | last post by:
Hi I have a pivot table that gets it data from another worksheet in the workbook. I need to update the data worksheet from data in a database (I'm using MS Data Application Block) and get a...
4
by: R.A. | last post by:
Hi, I have an web service method that accept an xml document and returns a different xml document. Based on the input xml I fill a dataset with information from a database. If the dataset has...
2
by: Carl Gilbert | last post by:
Hi I have a math kinda problem where I'm trying to split some lines when two or more lines connect two shapes. The reason I am doing this is to make it clear that there are multiple lines...
1
by: kingster | last post by:
Hi, I have a regular dataset and all i want to do is make a pivot table display in a browser with the datasource of the pivot table to be this dataset and then the end-user will be able to do...
9
by: PeteCresswell | last post by:
I've got something called "Reference Rates". The idea is that on a given day, we have various rates of return for various entities. e.g. Libor 3-month return, Libor 6-month return, US Treasury...
9
by: jsoques | last post by:
Hello, I created a Web Service using .Net 2.0 that has a function that returns a DataTable. I can test the function from the web page when I access the .asmx from a browser on localhost and it...
15
by: Joseph Geretz | last post by:
I'm a bit puzzled by the current recommendation not to send Datasets or Datatables between application tiers. http://support.microsoft.com/kb/306134 ...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.