What is the best way to do string manipulations when the string has double quotes. Say if I want to change a SQL where clause into a report header:
(("Health Code" = 'Asthma') AND ("Disease Severity"='Severe))...
into
Health Code = Asthma
Disease Severity = Severe
...
The problem is that the string functions in both js and asp cannot handle the double quotes. Any ideas???
Thanks!
Comments
: (("Health Code" = 'Asthma') AND ("Disease Severity"='Severe))...
:
First of all, are [b]Health Code[/b] and [b]Disease Severity[/b] fields names?
Please write your complete SQL statement for easier debugging.
[size=2]Neo Gigs[/size]
[color=blue]http://communities.msn.com.my/VisualBasicwithNeo[/color]
unescape(Request.Form("filter")
which gives a string typical of the one below:
(("Incurred As Of Date" BETWEEN DATE '2001-06-01' AND DATE '2001-06-30') AND ("Health Mgmt Disease Name"='Asthma') AND ("Disease Severity Name"='Mild') AND ("Age Group Name"='5 to 9 years old' AND "Age Group Category Name"='Children') AND ("Gender Code"='MALE') AND ("Region Name" LIKE 'CENTRAL MO OTHER' AND "Region Category Name"='Central MO'))
I then concat this where clause to a SQL statement and go to Oracle to populate my table on the page. I would just like to break this apart to generate a header for the report. The dbl quotes stop me in my tracks when I try to use replace functions and the like.
[size=2]Neo Gigs[/size]
[color=blue]http://communities.msn.com.my/VisualBasicwithNeo[/color]
<%@LANGUAGE = VBScript %>
<%Option Explicit%>
Specialized Drill Through Program
The list of parameters passed in was:
<%
dim mytest
dim re
dim patt
dim myarray
dim i
dim testval
set re = new regexp
re.global = true
mytest = Request.Form("filter")
patt = "x22"
re.Pattern = patt
mytest= re.replace(mytest,"")
patt = "x29"
re.Pattern = patt
mytest= re.replace(mytest,"")
patt = "x28"
re.Pattern = patt
mytest= re.replace(mytest,"")
patt = "'"
re.Pattern = patt
mytest= re.replace(mytest,"")
patt = "DATE"
re.Pattern = patt
mytest= re.replace(mytest,"")
patt = "AND"
re.Pattern = patt
mytest= re.replace(mytest,"")
response.write("<br>")
response.write("
")
myarray = split(mytest,"")
for i = 0 to 3'(split(mytest,""))
Response.Write(myarray(i))
Response.write("
")
next
%>
[size=2]Neo Gigs[/size]
[color=blue]http://communities.msn.com.my/VisualBasicwithNeo[/color]
Yes, remember I am just creating a header for the report (table). I pass the string as I get it from Cognos to Oracle with no changes.
str=Replace(str,chr(34),"")
Also, in VBScript when dealing with dbl-quotes you can represent one(1) double-quote as "". In the example above that would be:
str=Replace(str,"""","")
/Chris