CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge -> Tips & Solutions

 Part2: XML, AJAX, Office Web Components (OWC) tips and tricks

Print topic Send  topic

Author Message
Mango_Lier


Posts: 110
Posted: 02/02/2007, 3:28 PM

After all the ground work is done as described in Part 1…
http://forums.yessoftware.com/posts.php?post_id=84477

1) Expand common files node in the Project Explorer and open the “common.asp” file in the editor. Scroll all the way down and paste the following code between the “grey” area and the %>.
============CODE===============
Sub OutputXMLError(strMessage)
Response.Buffer = TRUE
Response.ContentType = "text/xml"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
Response.Write("<error>")
Response.Write("<message>")
Response.Write strMessage
Response.Write("</message>")
Response.Write("</error>")
Response.Flush
Response.End
End Sub

Sub OutputXML(RecordSet, XSLTransform)
Dim InputXMLDom, InputXLSDom, OutputXMLDom

Response.Buffer = TRUE
Response.ContentType = "text/xml"
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1

Set InputXMLDom = CreateObject("MSXML.DOMDocument")
RecordSet.Save InputXMLDom, 1

if Len(XSLTransform)=0 Then
Response.Write InputXMLDom.XML
Else
Set InputXLSDom = CreateObject("MSXML.DOMDocument")
InputXLSDom.load(Server.MapPath(XSLTransform))

Set OutputXMLDom = CreateObject("MSXML.DOMDocument")
Call InputXMLDom.transformNodetoObject(InputXLSDom, OutputXMLDom)

Response.Write OutputXMLDom.XML
End If

Response.Flush
Response.End

set OutputXMLDom = Nothing
set InputXMLDom = Nothing
set InputXLSDom = Nothing
End Sub
=============================
The code above prints the record set in XML form. For more info see: http://www.4guysfromrolla.com/webtech/041404-1.shtml

Save the file and close it.

2) By default the grid only pulls 20 records out of the database at a time (this can be changed in the properties window). We will change it via code.

3) open “dataislandXML” file in the editor. Select “MyXmlData” form in the project explorer and select “events” tab in the properties window (lower left hand corner)

4) For the server side events, select “Before Select” and add the following code.
MyXmlData.PageSize = 10000

The code above changes the page size so we pull 10,000 records from the DB. The intent is to get all the records. There are better ways to implement this event, but it is sufficient for this example.

5) Now select the “dataislandXML” page in the project explorer and add code to “Before Output” server side event

==== code ===
If MyXmlData.Errors.Count > 0 Then
Call OutputXMLError(MyXmlData.Errors.ToString)
Else
Call OutputXML(MyXmlData.Recordset.RecordSet, "")
End If
===========

Save the file and publish the project. With dataislandXML open in the editor do a “Shift +F10” to open the page in browser. After the login prompt, instead of the old grid you will get XML output for the recordset.

In part 3, we will hook up this XML with OWC pivot table and chart components.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.