View Full Version : Start and end date ???
nmabey414064
10-11-2010, 08:44 AM
The graph is displayed but there are no bars displayed. The tootlip only says "undefined".
I am connecting to a MSAccess database. The code looks like this:
Set WADWCStats_cmd = Server.CreateObject ("ADODB.Command")
WADWCStats_cmd.ActiveConnection = MM_diagramm9_STRING
WADWCStats_cmd.CommandText = "SELECT Stats_Date AS XLABEL, Stats_Date AS YVALUE FROM Stats WHERE Stats_Date >= #07-July-2010# AND Stats_Date <= #14-July-2010#"
WADWCStats_cmd.Prepared = true
Is there any SQL Date Problem using VB and MSAccess?
Can the dates also be set dynamic? eg. the customer choose dates with a datepicker or they are forwarded through input fields?
Thanks a lot, please be patient I am new to this all!
nmabey414064
10-12-2010, 03:44 AM
The chart is working now with set start and end date.
Can these dates also passed dynamic? e.g. a user picks dates with datepicker and than they are passed to the chart?
Thanks a lot for all the help
Dani Chankhour
10-12-2010, 12:18 PM
yes. you can pass the dates dynamically using the date picker, you will just need to make sure it is passing the right date format.
nmabey414064
10-13-2010, 08:22 AM
Thanks you for your reply.
But how?
My Query with manually picked dates (in the wizzard) reads:
"SELECT Date AS XLABEL, Minutes AS YVALUE FROM Stats WHERE ID= ? AND Date >= #07-09-2010# AND Date <= #07-12-2010#"
Now I would like to replace #07-09-2010# and #07-12-2010# with the values(variable) in the url (http://.../mysite2.asp?ID=4&StartDate=10-14-2010&EndDate=10-23-2010)
for StartDate and EndDate. These variable are passed into the url from a form (on prevoius page (.../mysite1.asp)).
I though of something like this:
Dim WADWC__ParamStartDate
WADWC__ParamStartDate = Request.QueryString("StartDate")
Dim WADWC__ParamEndDate
WADWC__ParamEndDate = Request.QueryString("EndDate")
SELECT Date AS XLABEL, Minutes AS YVALUE FROM Stats WHERE ID = ? AND Date >= @WADWC__ParamStartDate AND Date <= @WADWC__ParamEndDate "
But It doesn't work like this. Thanks for all your help!
nmabey414064
10-13-2010, 08:24 AM
sorry just seen that the url doesn't show right...
url reads (.../mysite2.asp?ID=4&StartDate=10-14-2010&EndDate=10-23-2010)
nmabey414064
10-14-2010, 02:22 AM
Hi,
I have read that the when I want to create a string, I must enclose the date in hashes so my next attempt looked like this:
Setting the variable like the wizzard is doing for the for other variables
(e.g. the ID when I filter by URL):
<%
Dim WADWC__ParamStartDate
WADWC__ParamStartDate = "-1"
If (Request.QueryString("StartDate") <> "") Then
WADWC__ParamStartDate = Request.QueryString("StartDate")
End If
%>
and then the query:
<%
Set WADWC_cmd = Server.CreateObject ("ADODB.Command")
WADWC_cmd.ActiveConnection = MM_Calendar6_STRING
WADWC_cmd.CommandText = "SELECT Date AS XLABEL, Minutes AS YVALUE FROM Stats WHERE Site_ID = ? AND Date = #" & WADWC__ParamStartDate & "#"
WADWC_cmd.Prepared = true
WADWC_cmd.Parameters.Append WADWC_cmd.CreateParameter("param1", 5, 1, -1, WADWC__ParamSite_ID)
%>
Sadly this doesn't work? WHy? Where am I doing the mistake?
Thanks for the help
nmabey414064
10-14-2010, 05:28 AM
The chart works when I wether send an ID or a date but not both...
The URL reads:
.../page2.asp?ID=5&StartDate=07-12-2010&EndDate=07-15-2010
and I get the error:
DynamicWebCharts/Data/page2_dataparser1.asp?ID=5
for some reason I have the feeling the graph should receive both ID and StartDate and not only the ID as the error message suggests.
The object that is created by the wizzard is:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="940" height="300">
<param name="movie" value="DynamicWebCharts/open-flash-chart.swf?data=DynamicWebCharts/Data/page2_dataparser1.asp?<%=Request.QueryString()%>" />
<param name="quality" value="high" />
<embed src="DynamicWebCharts/open-flash-chart.swf?data=DynamicWebCharts/Data/page2_dataparser1.asp?<%=Request.QueryString()%>" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="940" height="300"></embed>
</object>
and I think here is the mistake.
When I replace <%=Request.Querystring()%>
with:<%=Request.Querystring("ID")%>
the chart receives the ID and displays.
When I replace <%=Request.Querystring()%>
with:<%=Request.Querystring("StartDate")%>
the chart receives the StartDate and displays.
But how do I pass both variables to the chart?
Do I have to change something in the <object> bid? What?
Thanks a lot and sorry that I put more and more questions up here but I thought it might be better to understand my problem.
nmabey414064
10-14-2010, 07:21 AM
FINALLY IT WORKS!
the mistake was in the <object> bid.
I tried to connect the different variables with an "&" sign. But when passing variables from html to flash via Query String I need to use "%26" istead of the "&". How should you know that :).
I am sorry for posting and posting my thoughts here, but maybe it will also help somebody else.
Thanks
Dani Chankhour
10-14-2010, 12:43 PM
I'm glad you got it to work.
sorry i was not able to help you out with this issue since I'm not that familiar with ASP.
Again, thanks for posting your solution.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.