473,399 Members | 3,919 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,399 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 1937
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.