| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

04-22-07, 18:47
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
|
Newbie Question
|
|
Hello all...I have a question about ASP and VBScript. I have an ASP page that has some VBScript in it. There is a field on the form called frmreports.reportstring and there is a value assoicated with it. I m trying for that value in my server asp code to run a stored procedure. Is there a way to do it because as soon as there is a <% the variable goes blank and I cant seem to be able to move anything beyond <%.
Please help!!
|
|

04-22-07, 18:50
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
let me show you the code...right after the first line is where I m trying to get the value for frmReports.reportString.value but as soon as I put the <% I cant get anything.
Code:
window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)
<%
dim reportString
dim strQueryString
dim strQueryString1
dim strURL
dim reportid1
dim reportid2
reportString = frmReports.reportString.value
strQueryString = Instr(reportString,"rnum=") '25
reportid1 = mid(reportString,strQueryString+5,3)
msgbox frmReports.reportString.value, 48, "Show me the reportid1"
msgbox reportString, 48, "show me reportstring"
msgbox strQueryString, 48, "Show me StrQueryString"
msgbox reportid1, 48, "show me reportid"
'dim strQueryString
'dim strQueryString1
'dim strURL
'dim reportid1
'dim reportid2
'strURL = frmReports.reportString.value
'strQueryString = mid(strURL, Instr(1, strURL,"rnum")+3)
'strQueryString = Instr(strURL,"rnum=") '25
'strQueryString1 = Instr(strURL,"&db") '27
'reportid1 = mid(strURL,strQueryString+5,3)
'reportid2 = CInt(reportid1)
'document.write(reportid1)
'window.open(document.write(reportid1))
' ReportID1=rs(ReportID)
dim cmdform
set cmdform=CreateObject("ADODB.Command")
with cmdform
.ActiveConnection=mainconnection
.Commandtype=4
.CommandText="SP_REPORT_INCREMENT"
.parameters.append .createparameter("@ReportID",200,1,5,reportid1)
.parameters.append .createparameter("@strURL",200,1,80,reportString)
.parameters.append .createparameter("@strQueryString",200,1,80,strQueryString)
.parameters.append .createparameter("@strQueryString1",200,1,80,strQueryString1)
.Execute ,,128
End with
Set cmdform=nothing
%>
|
|

04-23-07, 02:16
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
|
|

04-23-07, 06:39
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
I did use Request.QueryString but it didnt return anyhting for some reason....I will try and see if Request.Form does anything...Thanks
|
|

04-23-07, 06:41
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Code:
window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)
What does this line do exactly?
|
|

04-23-07, 07:43
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
Quote:
|
Originally Posted by georgev
Code:
window.open(frmReports.reportString.value & bu & "&beginDate=" & frmReports.txtBeginDate.value & "&endDate=" & frmReports.txtEndDate.value & "&singleDate=" & frmReports.txtSingleDate.value & "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week)
What does this line do exactly?
|
This is the line that opens the report and that is where I m trying to increment 1 everytime a report is run since we are using a table in SQL Server 2000 for Reports and each report has its reportid. frmReports.ReportString.value is being populate with the values up in the script with all the variables that I want to use....another thing I want to mention is since the report id is no where on the form how am I suppose to use Request.Form?
|
|

04-23-07, 07:49
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
That was going to be my followup - I realised that you probably wern't using a form collection for this, so the request.form wouldn't work.
I have never used a window.open command, so could you explain what all the "junk" between the parens is?
|
|

04-23-07, 08:03
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
Quote:
|
Originally Posted by georgev
That was going to be my followup - I realised that you probably wern't using a form collection for this, so the request.form wouldn't work.
I have never used a window.open command, so could you explain what all the "junk" between the parens is?
|
frmreports.reportString.Value is being populated with:
response.write("frmReports.reportString.value=""" & rs("strReportURL") & "&tButton="& rs("strtButton") & "&rFile1="& rs("ReportGroup") & "&rnum=" & rs("ReportID") & """" & vbcrlf)
and reportID is what I m looking for in there but since there are quite a few scripts between here and where the frmReports.reportString.value is populated scope of the variable has been expired.
then there are some dates that are being entered on the form itself. There are some single dates that are only for the week and then there are dates that have start and end date. That is whats in the window open command....
frmReports.reportString.value Variable that has all the values I m looking for....
bu = business unit
beginDate=" & frmReports.txtBeginDate.value ---beginning date from the form
& "&endDate=" & frmReports.txtEndDate.value & ---end date from the form
"&singleDate=" & frmReports.txtSingleDate.value ---one date only from the form if the report is for a running week
& "&weekDate=" & frmReports.txtSingleDate.value & "&week=" & week --week based if there is only one date
|
Last edited by us1415; 04-23-07 at 08:07.
|

04-23-07, 08:09
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
Quote:
|
and reportID is what I m looking for in there but since there are quite a few scripts between here and where the frmReports.reportString.value is populated scope of the variable has been expired.
|
So would it be worth creating another variable earlier on and store the value in there? I'm assuming that you are closing the recordset which is why you cannot pick up the required value.
Code:
Dim SomeVariable
<open RS>
SomeVariable = RS("ReportID")
In theory, you should not be assigning all the values you need from the RS into variables so you can close the RS asap.
|
|

04-23-07, 08:15
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
Quote:
|
Originally Posted by georgev
So would it be worth creating another variable earlier on and store the value in there? I'm assuming that you are closing the recordset which is why you cannot pick up the required value.
Code:
Dim SomeVariable
<open RS>
SomeVariable = RS("ReportID")
In theory, you should not be assigning all the values you need from the RS into variables so you can close the RS asap.
|
That is true...would it close the RS even if I have some code that is closing the RS or should I remove the closing of RS from there altogether?
|
|

04-23-07, 08:18
|
|
www.gvee.co.uk
|
|
Join Date: Jan 2007
Location: UK
Posts: 10,156
|
|
I don't think I follow.
Here's what I would be doing
Code:
<open RS>
varBeginDate = RS("beginDate")
varReportID = RS("ReportID")
<close RS>
window.open( ... )
|
|

04-23-07, 09:43
|
|
Registered User
|
|
Join Date: Mar 2006
Posts: 7
|
|
I found a way around it...I m doing another window.open and pasrsing the variabe to another program that does the increment...Thanks for the suggestions though.....
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|