473,789 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3329
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_TNAServic e
Dim objTableNodes As IXMLDOMNodeList
Dim objDataNode As IXMLDOMNode
Dim RowCount As Integer
Dim ColCount As Integer
Set objNList = objWS.wsm_Get_A 21_Pivot

If Not objNList Is Nothing Then
objXmlDoc.LoadX ml objNList(1).XML
Set objTableNodes = objXmlDoc.getEl ementsByTagName ("Table")
If Not objTableNodes Is Nothing Then
RowCount = objTableNodes.L ength
If objTableNodes.L ength > 0 Then
ColCount = objTableNodes(0 ).childNodes.Le ngth
Else
MsgBox ("No Data Available For DownLoad."), vbInformation
Exit Sub
End If

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

Worksheets("Wor k").Activate
Range("A1") = "#"
Range("b1") = "Occupation al 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("Wor k").Cells(i + 2, j + 1) =
objDataNode.chi ldNodes(j).Text
Next j
Next i

'Make pivot
Worksheets("Sec tion A2").Activate

Dim PTCache As PivotCache
Dim pt As PivotTable

Set PTCache = ActiveWorkbook. PivotCaches.Add _
(SourceType:=xl Database, _
SourceData:=She ets("Work").Ran ge("A1").Curren tRegion.Address )

Set pt = PTCache.CreateP ivotTable _
(TableDestinati on:="A.2.1.", TableName:="Piv ot1")

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.Piv otTables("Pivot 1").RowGrand = False

ActiveSheet.Piv otTables("Pivot 1").PivotFields (4).PivotItems( "M").Positi on = 1

ActiveSheet.Piv otTables("Pivot 1").PivotFields (4).PivotItems( "F").Positi on = 2

ActiveSheet.Piv otTables("Pivot 1").PivotFields (4).PivotItems( "Disabled").Pos ition = 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
1893
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 excel object from within Access. Since my customer have installed O2K SP3 - the Makro does not run any longer. The curiosity is: If you open the Excel Object from within Access and then store it to a local file - then reopen this file - the same...
4
9463
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 from my function. Will it be efficient to use a SQLDataReader or a DataSet for this situation? I understand from the documentation that there can be only one SQLDataReader associated with a connection open at a time. So, it seems like I can't...
1
1526
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 dataset with the data in it. I need to know how to open the workbook, delete all the data in the data worksheet, update the data worksheet from the data in the dataset and then allow the user to download the new excel workbook. Anyone have any ideas...
4
33403
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 rows then I need to return those rows to the consumer. I can't tell if the consumer of the web service will use .Net or maybe java. 1) If the web service method returns a Dataset then the consumer will get information on the Dataset. What if the...
2
3115
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 connecting the two shapes. http://www.blackwaterbadgers.co.uk/image1.bmp Image 1 shows how if you have a line between two shapes, the line is straight. if you have more than one line, the lines will start overlapping
1
7355
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 whatever they want ... i dont need to do any special formatting just a straigh ot pivot tables usign sql server, asp.net, vb.net, OWC 10
9
6799
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 Bonds, the Prime rate, and so-forth. We associate a security with one of those rates. There are a set of rates for each calendar day, and the rates for that
9
12025
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 works. I can also test the function using VB6 and the xmlhttp activex object. The problem I have now is when using VS 2005 or VB.Net 2005 Express and creating a web references is that the proxy created doesn't map the function as returning a DataTable...
15
13517
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 http://msdn2.microsoft.com/en-us/library/ms996381.aspx Formerly, with classic Microsoft DNA architecture, the ADO Recordset was a primary transport medium, recommended for transmitting data between application tiers. In fact, there are whole books written on the subject.
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.