Sign in to follow this  
shockwave100

Converting Graph in ASP to ASP.net

Recommended Posts

Hi all,

I am a newbie when it comes to web development and have been sucessful in creating a page in asp however I am having difficulty tring to convert this in to asp.net. Can anyone have a look at my code to see what parameter stuff I need to add in?

Been pulling my hair out trying to trouble shoot and fill in the blanks with my limited knowledge. Hoping that a kind individual will be able help me with a quick fix. I have attempted to try and change it to make it asp.net compliant, but it was a little dodgy so I have just supplied the raw code below that works in an asp page.

Here is the code:

<%@ Language=VBScript %>

<HTML>

<HEAD>

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">

 

 <SCRIPT LANGUAGE="Javascript" SRC="Charts/FusionCharts.js"></SCRIPT>

 <style type="text/css">

 <!--

 body {

font-family: Arial, Helvetica, sans-serif;

font-size: 12px;

 }

 -->

 </style>

</HEAD>

<%

%>

<!-- #INCLUDE FILE="Charts/FusionCharts.asp" -->

<BODY>

 

<CENTER>

<h2>AAPT Australian Operations</h2>

<p>This chart can be relicated to suit view based on mdx query.</p>

<%

 

 

Dim cn

Dim cat

Dim cel

Dim strMDX  

Dim sConnect

Dim sXML 

'------------- Open up connection to OLAP database ----------------------

 

Set cn = Server.CreateObject("ADODB.Connection")

cn.Mode = 3

cn.CursorLocation = 2

cn.IsolationLevel = 4096

'Error when tyring to reference tm1 macro for parameter Location=" & Run("OPTGET", "AdminHost ")

'hardcoded instead

sConnect = "DATA SOURCE=mydatasource;PROVIDER=MYOLAP;Location=Aunswa155"

cn.Open sConnect, "username", "password" 

 

'---------------------------------------------------------------------------------

' INSERT MDX STRING HERE

strMDX = "SELECT {[accounts].[AAPT_REV],[accounts].[COS],[accounts].[OP_COSTS],[accounts].[AAPTEBITDA]} ON COLUMNS,"

strMDX = strMDX & "{[Month].[Jul],[Month].[Aug],[Month].[sep],[Month].[Oct],[Month].[Nov],[Month].[Dec],[Month].[Jan],[Month].[Feb],[Month].[Mar],[Month].[Apr],[Month].[May],[Month].[Jun]} ON ROWS"

strMDX = strMDX & " FROM [Reportingaapt]"

strMDX = strMDX & " WHERE ([Company].[TPWT],[transindicator].[All Indicators],[tradingindicator].[All tradingpartners],"

strMDX = strMDX & "[accessmethod].[ALLAccessMethods],[coo_ausext].[Au_ext],[measures].[Financial],[Year].[2008],[Version].[Reported],[product].[TOT_PRODUCT])"

'-----------------------------------------------------------------------------------

'  OPEN Cellset Object

Set cel = Server.CreateObject("ADOMD.Cellset")

cel.Open strMDX,cn

 

'----------------------------------------------------------------------------------------------

'Get Dimension and position index to return data from cube

intDCO = cel.Axes(0).DimensionCount - 1

intDC1 = cel.Axes(1).DimensionCount - 1

intPCO = cel.Axes(0).Positions.Count - 1

intPC1 = cel.Axes(1).Positions.Count - 1

Response.Write "<BR><H4>Results:</H4>"

'------ Define headings and labels -------

 

 sXML = sXML & "<chart caption='REVENUE v COS V OPEX V EBITDA (FY08)' numberPrefix='$' formatNumberScale='1' rotateValues='0' placeValuesInside='1' decimals='0'" & ">"

 'sXML = sXML & "<chart caption='AAPT Australian Operations EBITDA V REVENUE' xAxisName='Month' yAxisName='Dollars' showValues='0'   formatNumberScale='0' showBorder='1'" & ">"

 sXML = sXML & "<categories" & ">"

 

'------ Define categories ---------------

 

 For yy = 0 to IntPC1

For r = 0 to intDC1

 sXML = sXML & "<category label=" & "'" & cel.Axes(1).positions(yy).Members®.Caption & "'" & " />"

Next

 Next 

 sXML = sXML & "</categories" & ">"

'------- define first dataset ------- 

 

 sXML = sXML & "<dataset seriesName='Revenue'" & ">"

 For yy = 0 to IntPC1 

For z = 0 to intPC0

sXML = sXML & "<set value=" & "'" & FormatNumber(cel(z,yy).Value,0,,,0) & "'" & " />"

Next

 Next 

 sXML = sXML & "</dataset" & ">"

 

'------- define second dataset ------- 

sXML = sXML & "<dataset seriesName='COS'" & ">"

 For yy = 0 to IntPC1 

For z = 0 to intPC0

sXML = sXML & "<set value=" & "'" & FormatNumber(cel(z + 1,yy).Value,0,,,0) & "'" & " />"

Next

 Next 

 sXML = sXML & "</dataset" & ">"

'------- define third dataset ------- 

sXML = sXML & "<dataset seriesName='OPEX'" & ">"

 For yy = 0 to IntPC1 

For z = 0 to intPC0

sXML = sXML & "<set value=" & "'" & FormatNumber(cel(z + 2,yy).Value,0,,,0) & "'" & " />"

Next

 Next 

 sXML = sXML & "</dataset" & ">"

 

'------- define forth dataset ------- 

'sXML = sXML & "<dataset seriesName='EBITDA'" & ">"

 'For yy = 0 to IntPC1 

'For z = 0 to intPC0

'sXML = sXML & "<set value=" & "'" & FormatNumber(cel(z + 3,yy).Value,0,,,0) & "'" & " />"

'Next

 'Next 

 'sXML = sXML & "</dataset" & ">"

 

'--- close graph ----------

sXML = sXML & "<" & "/chart" & ">"

Call renderChart("Charts/MSLine.swf", "", sXML, "", 600, 300, false, false)

cn.close

Set cel = nothing

Set cat = nothing

Set cn = nothing

%>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this