473,228 Members | 1,755 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,228 software developers and data experts.

Parsing Data in ASP

I have a select statement that gives me the following results (for
example) "test documentation/software product version document.doc" I
need to parse the data to only grab everything between the "/" and
".". So, in other words, "software product version document" - I have
absolutley no idea how to do this - can anyone help????

Thanks in advance!
Lisa
Jul 19 '05 #1
9 1922
Lisa wrote:
I have a select statement that gives me the following results (for
example) "test documentation/software product version document.doc" I
need to parse the data to only grab everything between the "/" and
".". So, in other words, "software product version document" - I have
absolutley no idea how to do this - can anyone help????

Thanks in advance!
Lisa

I need to ask: is this truly represtative of your data? Could there be more
than one "/", or more than one "."? If so, you need to let us know if you
want the parsing to start at the first or last incidence of each character.

Do you need the Select statement to return the entire string? If not, then
let us know what database type and version you are using so we can show you
how to do it in your query.

If you need both the entire string, and you need to parse it as well, then
you will be better off doing it in vbscript in your asp page.
Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
Bob,
Yes that is an actual representative of my data. The only "variable"
would be anything betweem "/" and ".". An actual example of my select
results is: "Testing Documentation/Borland JBuilder 6.0 Validation
Document.doc"

My code looks like this:
Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufacturer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateObject("Adodb.command")
Set OBJcmd.ActiveConnection = oConn OBJcmd.CommandText = "SELECT * FROM
DocMd WHERE URL LIKE '%" & strOldDocName & "%' ORDER BY URLID DESC;"
Set rs = OBJcmd.execute

fullfilename = rs.Fields("URL")- this is was generates the data
mentioned above.

strIncremental = FullFileName + "1"

I need "strIncremental" to actually equal Parsed(FullFileName) + 1

If NOT rs.EOF THEN
GetFileName = strIncremental
Else
GetFileName = strOldDocName
End If

Lisa

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #3
Lisa . wrote:
Bob,
Yes that is an actual representative of my data. The only "variable"
would be anything betweem "/" and ".". An actual example of my select
results is: "Testing Documentation/Borland JBuilder 6.0 Validation
Document.doc"
You see? There are two "."'s there. Will it always be the last "." that you
want?

My code looks like this:
Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufacturer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateObject("Adodb.command")
Set OBJcmd.ActiveConnection = oConn OBJcmd.CommandText = "SELECT *
Don't be lazy. Avoid select * in production code:
http://www.aspfaq.com/show.asp?id=2096
FROM DocMd WHERE URL LIKE '%" & strOldDocName & "%' ORDER BY URLID
DESC;" Set rs = OBJcmd.execute

fullfilename = rs.Fields("URL")- this is was generates the data
mentioned above.


Will you be doing anything else with fullfilename besides parsing it? Based
on this code, the answer is no, but there may be code you haven't shown us

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #4
You see? There are two "."'s there. Will it always be the last "." that
you
want?
I see your point. Yes I will always want the last "." in the string

and that will be my only referrence to FullFileName.

Lisa

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5
Lisa . wrote:
You see? There are two "."'s there. Will it always be the last "."
that you
want?
I see your point. Yes I will always want the last "." in the string

and that will be my only referrence to FullFileName.

Lisa

What database are you using? This can probably be done in your query.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #6
Is it possible to check Hotmail email with an ASP?
Jul 19 '05 #7

sorry I thought I posted my database info in my last message... I'm
using SQL 7

~L~
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #8
Lisa . wrote:
sorry I thought I posted my database info in my last message... I'm
using SQL 7

~L~


OK, here's a SQL 7+ solution (you should probably encapsulate this in a
stored procedure rather than using dynamic sql):

Dim sSQL
sSQL = Select substring(REVERSE(Right(reverse(URL), " & _
"len(URL) - charindex('.',REVERSE(URL)))),charindex('/',URL) " & _
"+ 1,100) as filename FROM DocMd WHERE URL LIKE '%" & _
strOldDocName & "%' ORDER BY URLID DESC;"
'for debugging:
'response.write sSQL
Set rs=oConn.Execute(sSQL,,1)
parsedFilename = rs("filename")

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #9
Bob,
I found what I was looking for....thought I would share, thanks!

Dim strOldDocName, strIncremental, GetFileName, fullFileName
strOldDocName = softwareManufacturer + " " + softwareProduct + " " +
softwareVersion

set OBJcmd = Server.CreateObject("Adodb.command")
Set OBJcmd.ActiveConnection = oConn
OBJcmd.CommandText = "MY SELECT STATEMENT;"
Set rs = OBJcmd.execute

fullFileName = rs.Fields("URL")
Dim text, found, arrText, newDoc
text = fullfilename
arrText = Split(text,"/")
For each item in arrText
if InStr(item,".doc") > 0 then
newDoc=replace(item,".doc","")
end if
next
strIncremental = newDoc + "1"
If NOT rs.EOF THEN
GetFileName = strIncremental
Else
GetFileName = strOldDocName
End If

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Kylotan | last post by:
I have a text file where the fields are delimited in various different ways. For example, strings are terminated with a tilde, numbers are terminated with whitespace, and some identifiers are...
8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
3
by: Girish | last post by:
Hi All, I have written a component(ATL COM) that wraps Xerces C++ parser. I am firing necessary events for each of the notifications that I have handled for the Content and Error handler. The...
4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
3
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story>...
1
by: yonido | last post by:
hello, my goal is to get patterns out of email files - say "message forwarding" patterns (message forwarded from: xx to: yy subject: zz) now lets say there are tons of these patterns (by gmail,...
9
by: ankitdesai | last post by:
I would like to parse a couple of tables within an individual player's SHTML page. For example, I would like to get the "Actual Pitching Statistics" and the "Translated Pitching Statistics"...
5
by: randy | last post by:
Can some point me to a good example of parsing XML using C# 2.0? Thanks
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.